The OPM query language (OPM-QL) follows the ODMG standard for object-oriented query languages [12]. An OPM query may involve local, inherited, derived and system attributes and path expressions formed by composing these attributes.
An OPM-QL data-manipulation statement may be either a SELECT, INSERT, DELETE, or UPDATE statement. A SELECT statement retrieves data from one or more target classes, while INSERT, DELETE and UPDATE statements respectively add, remove or change data in a single target class. These statements can involve conditions consisting of and-or compositions of atomic comparisons of attributes, path expressions or constants.
An OPM SELECT query consists of three parts: a SELECT statement specifying which data should be retrieved from the objects and/or protocols satisfying the query conditions; a FROM statement specifying the object and protocol classes considered by the query; and an optional WHERE statement specifying conditions on objects and/or protocols. Intuitively the meaning of a SELECT query is ``for each binding of variables specified in the FROM statement, such that the conditions specified in the WHERE statement are satisfied, return the values of the attributes specified by the SELECT statement''.
A variable declaration in a FROM statement names a variable and declares the set of values that it may range over. The select statement binds expressions to the various attributes in the result of a query. A query will therefore return a set of tuples, with the specified attributes.
SELECT E(ExperimemtTitle, ExperimentPurpose)
FROM E IN Experiment, N IN ExperimentNotes, D IN E.Devices
WHERE E = N.Experiment, AND N.Type = "cnc" AND D.DeviceName = "spectrometer";
For example, in the above query, the variable E ranges over the objects of class Experiment, N ranges over ExperimentNotes and D ranges over the Devices used in experiment E. So the query retrieves the title and purpose of any experiments involving a ``spectrometer'' for which an associated conclusion note exists.