Representation of general and polyhedral subsemilattices and sublattices of product spaces