Add support for queries based on defined relationships.