- From: Seaborne, Andy <andy.seaborne@hp.com>
- Date: Mon, 22 Jun 2009 13:47:49 +0000
- To: "public-rdf-dawg@w3.org" <public-rdf-dawg@w3.org>
ISSUE-29 I've implemented negation for ARQ. It should be compatible with kasei's implementation. What's implemented are EXISTS and NON EXISTS (UNSAID is an alias) operators for graph matching, and also the same operators inside a FILTER. # Names of people who have not stated that they know anyone PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?x foaf:givenName ?name . NOT EXISTS { ?x foaf:knows ?who } } (base <file:///c:/home/afs/Projects/ARQ/> (prefix ((foaf: <http://xmlns.com/foaf/0.1/>)) (project (?name) (filter (! (exists (bgp (triple ?x foaf:knows ?who)))) (bgp (triple ?x foaf:givenName ?name)))))) In this form, the NOT EXISTS is a filter that occurs, logically, exactly where it is placed. It does break up a BGP. Filter optimization works as before. When in a FILTER, the usual FILTER rules apply (IFLTERS do not break up a BGP, they logically happen at the end of the BGP in which they are written regardless of exact placement within the BGP). # Names of people who have not stated that they know anyone PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX ns: <http://example/ns#> SELECT ?name WHERE { ?x foaf:givenName ?name . FILTER(NOT EXISTS { ?x ns:age ?v }) } Overall, the adding of two forms (EXISTS and NON EXISTS) in both graph pattern and FILTER was minimal extra work. What work there was, was mainly because I preserved exactly the form written and don't transform NOT EXIST to (! (exists ....)) as early as could have been done, as it would loose the details of what syntax was actually used. There is a token NOT<WS>*EXISTS so NOTEXISTS, NOT EXISTS, NOT\newlineEXISTS are the same token. Andy http://jena.sourceforge.net/ARQ/negation.html -------------------------------------------- Hewlett-Packard Limited Registered Office: Cain Road, Bracknell, Berks RG12 1HN Registered No: 690597 England
Received on Monday, 22 June 2009 13:48:44 UTC