EXISTStential Aspects of SPARQL

Peter F. Patel-Schneider, David Martin
2016 International Semantic Web Conference  
The SPARQL 1.1 Query Language [1] permits patterns inside FILTER expressions using the EXISTS construct, specified by using substitution. Substitution destroys some of the aspects of SPARQL that make it suitable as a data access language. As well, substitution causes problems in the SPARQL algebra and produces counterintuitive results. Fixing the problems with EXISTS is best done with a completely different definition that does not use substitution at all. EXISTS is used inside FILTER
more » ... to determine whether a pattern matches or does not match. EXISTS can be used to find people who do not have any names, as in this example from the SPARQL specification [1, §8.1.1]: SELECT ?person WHERE { ?person rdf:type foaf:Person . [1] FILTER NOT EXISTS { ?person foaf:name ?name } } Any SPARQL pattern can be used in an EXISTS, including subqueries, as in a query to find people who know someone who knows more than 100 others: SELECT ?person WHERE { ?person foaf:knows ?friend . FILTER EXISTS { SELECT ?friend WHERE { ?friend foaf:knows ?y . } GROUP BY ?friend HAVING ( COUNT(*) > 100 ) } }
dblp:conf/semweb/Patel-Schneider16 fatcat:m6dhvcbvprbltn3yzwfjklriwq