SPARQL: Inverse result on boolean query

741 views Asked by At

I am trying to have SPARQL return 'false' if a set of triples exist in an RDF database. I'm able to return 'true' with an ASK query.

ASK WHERE { ?subjID rdf:type pref:Person. }

As described here, I tried adding NOT EXISTS { } inside of the WHERE, but this results in an error.

ASK WHERE { NOT EXISTS { ?subjID rdf:type pref:Person. } }
1

There are 1 answers

9
Neil Graham On

The documentation that I linked doesn't describe this but you must put FILTER in front of NOT EXISTS.

ASK WHERE { FILTER NOT EXISTS { ?subjID rdf:type pref:Person. } }