Test Expressions

Both conditions and constraints use test expressions, represented by the test element, to describe the required comparison. Conditions test attribute values for a single database entity whereas constraints compare attribute values or IDs for two database entities. Proximity uses the same DTD elements to represent these query constructs, although each will be realized in somewhat different forms in the XML representation. See the examples under “Conditions” and “Constraints” for examples of each form.

<test>

Attributes  None.

Children 

The cardinality of test’s children, listed below, reflect the legal uses of these elements based on a query’s semantics rather than the restrictions imposed by the DTD.

operator exactly one The comparison operator; used in both conditions and constraints
attribute-name zero or one Name of attribute(s) to be compared; used in condition elements
value zero or one Value to be compared to that for the specified attribute; used in condition elements
item zero or two Provides data for one of the items being compared; used in constraint elements

Content Model 

(operator, (attribute-name | value | item),
           (attribute-name | value | item)?)

Example See “Conditions” and “Constraints”.

<item>

The item element describes one of the two items being compared in a constraint. The name of the item is contained in the required item-name element. Attribute constraints use the attribute-name element to indicate which of this item’s attribute’s values are to be compared. Identity constraints use the id element to indicate that the constraint compares IDs rather than attribute values.

Attributes  None.

Children 

item-name exactly one Name of vertex or edge whose attribute is being compared
attribute-name exactly one Name of attribute to be compared
id zero or one Indicates constraint is to compare IDs rather than attribute values

Content Model 

(item-name, (attribute-name | id))

Example  See “Constraints”.