Proximity supports a heterogeneous database structure, in which objects and links can have variable numbers of attributes, including none. For example, if a database contains information about movies, some movie objects might have a value for a Genre attribute while other movie objects might omit this attribute. QGraph lets you test whether an object or link has a value for a given attribute by using an existence condition.
The graph in Figure 3.5 represents part of a database containing information about books and authors. Because some authors write books under pseudonyms, we represent that information with a WrittenAs attribute on the link connecting authors and books they’ve written. As shown below, the author Ed McBain has written books both under his own name as well as under multiple pseudonyms.
The query in Figure 3.6 finds author-book pairs where the author wrote the book under an assumed name. We use an existence condition to capture the fact that the link must have a WrittenAs attribute but that we do not care about its value.
The results of executing the query on this database fragment are shown in Figure 3.7.
Existence conditions test only whether the matching database
entity does or does not have the specified attribute. The attribute’s
value is not specified in the query and is not examined when evaluating
the query. The query returns all matching subgraphs
where the author-of link has a
WrittenAs attribute, regardless of that
attribute’s value.