next up previous contents
Next: Optional part Up: Body Previous: Direct property   Contents

Non-existent relation

A limited form of negation is provided in the Corese query language; it is a negation as failure: a not operator is provided to prefix properties that should not be found in an annotation for it to be considered as an acceptable result. For instance, the following query retrieves all the documents which have not been graded yet.

?doc not::kmp:grade ?g

Other example that returns only the persons that are not authors of a thesis.

?x   rdf:type        kmp:Person
?x   kmp:name        ?name
?x   not::kmp:author ?doc
?doc rdf:type        kmp:Thesis

Limitation : in the last example, if one wants ?x as result, the query must contain a positive (i.e. not a negation) relation on the same variable (here ?x).

The scope of the negation is the relation. The query engine perfoms no type inference from signature in a negation.

Constraint checking is possible in a negation. For example, find a resource that is related to only one resource :

?x c:related ?y
?x not::c:related ?z
?z != ?y



Olivier Corby 2005-07-01