Querying object structures requires navigation. An example object structure was shown on the navigating objects page. An example of an ODMG OQL query follows. This query appears in the published ODMG standard. For those of you who know SQL, you will notice that it is similar to an SQL query, but with object extensions. The similarity occurs because OQL is based on SQL-92.
from Persons p, p.children c
where p.address.street = "Main Street"
and count(p.children) >= 2
and c.address.city != p.address.city
The "dot" notation used in the query traverses the data structure shown on the navigating objects page. The query inspects all children of all Persons to find people who live on Main Street with at least two children. It returns only those addresses of children who do not live in the same city as their parents. It navigates from the Person class using the child reference to another instance of the Person class and then to the Address and City classes.
ODMG OQL is not the only way to write these object queries. Similar queries can be written using the other query languages used by some of the object database products.
Based on this information, we can now go to the better DBMS Matrix page.
More on the general topic: Stonebraker's DBMS Matrix