EQL provides two negation operators.
As the EBNF grammar shows, EQL provides two negation operators:
An example of the not operator is:
collection()/record[not(Recordtype = "author")]
An example of the != operator is:
collection()/record[Recordtype != "author"]
Although both operators look like they work the same, each in fact may return a different record set. Using the above two sample queries:
The not operator example returns any record which does not have a Recordtype property with value "author" (including records which have no Recordtype properties at all).
The != operator returns only records which have non-"author" Recordtype property values. This operator excludes records which have no Recordtype properties.
The small (but noticeable) difference in the result sets may be a useful distinction for your application.
EQL supports filtering by the absence of assignments on records. By using the not operator, you can filter down to the set of records which do not have a specific property assignment.
For example:
collection()/record[author_id]
returns all records with the "author_id" property, while:
collection()/record[not (author_id)]
returns all records without the "author_id" property.