Attribute constraints are used to compare attribute values across different database entities. (See “Implementation in Proximity” later in this chapter, however, for important restrictions regarding mixing object and link attributes in a constraint in Proximity.)
Figure 5.14 shows a fragment of a database containing information about movies released as DVDs. Note that Proximity databases do not necessarily have to be fully connected; as this example illustrates, discontinuities are permitted.
Suppose that we want to find movies released as DVDs in the same year as their theatrical release. Figure 5.15 shows the QGraph query for this task.
The query’s constraint requires that the value of the
ReleaseYear attribute of the object corresponding to
the movie vertex be the same as the value of the
PubYear attribute of the object corresponding to
the DVD vertex.
Figure 5.16 shows the results of
executing the above query on the database fragment shown in
Figure 5.14.
The query finds two subgraphs where a movie’s DVD release
occurred in the same year as its theatrical release.