  We call a restriction semigroup almost perfect if it is proper and its least
monoid congruence is perfect. We show that any such semigroup is isomorphic to
a `$W$-product' $W(T,Y)$, where $T$ is a monoid, $Y$ is a semilattice and there
is a homomorphism from $T$ into the inverse semigroup $TI_Y$ of isomorphisms
between ideals of $Y$. Conversely, all such $W$-products are almost perfect.
Since we also show that every restriction semigroup has an easily computed
cover of this type, the combination yields a `McAlister-type' theorem for all
restriction semigroups. It is one of the theses of this work that almost
perfection and perfection, the analogue of this definition for restriction
monoids, are the appropriate settings for such a theorem. That these theorems
do not reduce to a general theorem for inverse semigroups illustrates a second
thesis of this work: that restriction (and, by extension, Ehresmann) semigroups
have a rich theory that does not consist merely of generalizations of inverse
semigroup theory. It is then with some ambivalence that we show that all the
main results of this work easily generalize to encompass all proper restriction
semigroups.
  The notation $W(T,Y)$ recognizes that it is a far-reaching generalization of
a long-known similarly titled construction. As a result, our work generalizes
Szendrei's description of almost factorizable semigroups while at the same time
including certain classes of free restriction semigroups in its realm.
