MINUS

The MINUS qualifier allows to exclude certain data.

Given a database with persons we have a given name and family name and one wants to nothing else than all triples, but not Triples that fulfill a specified condition, e.g. one do not want that the given name of any Resource or Subject has a certain Value. So the result will contain only Triples where the results has other names than that was specified.

  • Filtering of query solutions by removing possible solutions with MINUS

Data:

@prefix : <http://example.com>] .
@prefix foaf: <http:/xmlns.com/foaf/0.1>

:hevok foaf:givenName "Hevok" ;
       foaf:familyName "n/a" .

:eva foaf:givenName "EVA"
     foaf:familyName "unknown" .

:herbert foaf:givenName "Herbert" ;
         foaf:familyName "Kaebie" .

Query:

PREFIX : <http://example/>]
PREFIX foaf: <http://xmlns.com/foaf/0.1/>]
SELECT DISTINCT ?s
WHERE {
    ?s ?p ?o .
    MINUS {
        ?s foaf:givenName "Herbert" .
    }
 }

Result:

?s
:hevok
:eva
minus.png/
Edit tutorial

Comment on This Data Unit