Multiple Constraints

In principle, QGraph permits any boolean combination of constraints. In query diagrams, like that shown in Figure 5.17, we simply list all the constraints with the understanding that they must all be satisfied. (Proximity, however, requires that multiple constraints always be ANDed together. You cannot combine constraints with OR or use NOT in a constraint.)

Query with multiple constraints

Figure 5.17. Query with multiple constraints


This query finds books that have been adapted to movies where both the book and movie have the same name, and where the book was published before the movie was released.

Queries may include both identity and attribute constraints, but an individual constraint may not attempt to compare identity with attribute values. For example, if a database includes objects with an age attribute, a query for that database might include both an identity constraint such as vertex1 < > vertex2 and an attribute constraint such as vertex1.age < vertex2.age, but it may not include a constraint such as vertex1 < vertex2.age that attempts to compare identity to an attribute value.