General query requirements
See the Proximity QGraph Guide for a complete description of the QGraph language as implemented in Proximity.
Queries run from the Query Editor are always executed against the entire database.
Queries run from the Proximity Database Browser or from the command line can be optionally executed against the contents of a container.
The QGraph
DTD,
graph-query.dtd,
must reside in the same directory as the query file.
Make sure that you copy the DTD file from
$PROX_HOME/resources to the directory
containing the query file before executing the query.
Every query must have at least one vertex.
Every query edge must have vertices at both ends.
Queries must be connected.
Queries must remain connected after any optional or negated elements are removed.
Each vertex and edge in a query must have a unique label (name).
Proximity ignores case when matching attribute names to those in the database. Proximity obeys case when matching attribute values with those in the database.
Condition requirements
Attribute value conditions restrict query matches to objects or links that match the specified attribute value.
Existence conditions restrict query matches to objects or links that have any value for the specified attribute.
Use disjunctive normal form in prefix notation to create complex conditions from simple conditions.
Surround values (i.e., vertex and edge labels or attribute names and values) containing spaces with single quotes.
Annotation requirements
An edge incident to an annotated vertex must be annotated.
The boundary edge of an annotated subquery must be annotated.
At most, only one of two adjacent elements can be annotated; no edges are allowed between two annotated elements.
Constraint requirements
Identity constraints compare IDs with each other.
Attribute constraints compare attribute values with each other.
Mixing IDs and attribute values in a constraint is not permitted. (You may, however, compare values for different attributes as long as they are of comparable types.)
Constraints are only allowed between two vertices or two edges; mixing vertices and edges is not permitted.
No constraints are allowed between two annotated elements.
If one of two items in a constraint is annotated, the other cannot be part of an annotated subquery.
With one exception, Proximity prohibits constraints between
two edges when one of them is annotated. Proximity allows such
constraints when the vertex adjacent to the annotated edge is itself
annotated with [0..] or
[0...
j]
Constraints can only be combined with AND; OR and NOT are not allowed.
Constraints that cross subquery boundaries require that one
of the items being compared be optional (have an annotation of
[0..] or
[0..).
j]
Surround values (i.e., vertex and edge labels or attribute names and values) containing spaces with single quotes.
Subquery requirements
A subquery must be a well-formed query by itself.
All subqueries must be annotated.
The boundary edge of a subquery must be annotated.
The boundary vertex of a subquery cannot be annotated.
The vertex outside the subquery connected to the boundary edge cannot be annotated.
Update requirements
The QGraph language provides full update functionality; however, Proximity currently implements only the ability to add links using queries.
A query’s match phase is distinct from its update phase; new database elements added by a query do not change a query’s matches.
New database elements added by a query are not included in the query’s results (subgraphs).
You must specify an attribute value for all new links. The attribute value must be constant—the same for all new links added by the query.
Additional Information
See the Proximity QGraph Guide for additional details on the QGraph language and it’s implementation in Proximity.
See Chapter 7, Learning Models for more information on how query elements and labels are used by Proximity’s models.
See Appendix A, Proximity Quick Reference for a summary of how to use the location bar to directly access Proximity database elements including containers and subgraphs.