add implementation and test for restrict

new implementation for restrict might actually work for any relation,
which means I could remove it from the interface.