As we saw with conditions, the process of evaluating attribute constraints must take into account that attributes are set valued. Constraints follow the same evaluation principle as do conditions: A constraint is satisfied if any member of the set of attribute values satisfies the constraint.
As an example, let’s look at a fragment of a database describing books and related movies, shown below.
Because books are often reissued or issued in different formats, they
can have multiple publication dates, as we see with
Carrie. Also,
books and movies can have varying temporal relationships. Frequently,
movies are adapted from an existing book, as we see for A
Beautiful Mind, but occasionally a screenplay or novelization
is published after a successful movie, as is the case for
Shakespeare in Love. And sometimes we know that a
book’s movie rights have been optioned, but the movie has not
yet been released, as we see for Bag of Bones.
This database has no attributes on the links connecting books and their associated movies. Although this is a directed link, as Proximity requires, the lack of any attributes means that we have no semantics for this link and thus cannot assign a temporal ordering based on the arrow’s direction. We could have just as easily reversed the links without changing the information represented by these objects and links.
Suppose we want to find both categories of books—those released before their movie adaptation, and those initially published after the movie’s release. We need two queries to do so:
The results of executing the first query are shown below:
The resulting container includes two subgraphs.
The movie A Beautiful Mind was based on the book
written by Sylvia Nasar, so it came out after the book’s publication.
Carrie was originally published before the movie
adaptation, then re-released in various formats after the movie’s
release.
Compare these matches to those for the second query:
This time, the movie Shakespeare in Love appears
in the results; its associated book is a screenplay based on the
movie. But Carrie appears again, this time
because re-releases of the book occurred after the movie’s
release.
Because objects and links in a Proximity database can be structurally heterogeneous, some entities may not have a value for an attribute used in a constraint. In our example database fragment, because the movie version of Bag of Bones has not been released yet, the corresponding database object has no value for the ReleaseDate attribute. In such cases, an attribute constraint’s test always fails because there are no values to compare against the constraint’s requirements. Therefore Bag of Bones does not appear in any of our query results.
As we saw for conditions, the ability to have set-valued attributes can result in satisfying apparently contradictory constraints. In this case, the book-movie pair for Carrie appears in the results for both queries because the multiple book publication dates contain values that satisfy both constraints. Specifically, the values for the book’s publication date attribute include a value (1974) that is before the movie’s release date of 1976, and several values (1981, 1993, and 2003) that are after the movie’s release date.