SPARQL Basics
Variable
A name starts with "?", e.g. ?mbox
WHERE Clause
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?mbox
WHERE
{ ?x foaf:name ?name .
?x foaf:mbox ?mbox }?x foaf:name ?name matches a triplet in a KG. ?x refers to the head entity. foaf:name matches a relationship. ?name refers to the tail entity. The period operator . means "AND".
Operators
Semicolon
Triple patterns with a common subject can be written so that the subject is only written once and is used for more than one triple pattern by employing the ";" notation.
?x foaf:name ?name ;
foaf:mbox ?mbox .is equivalent to
Square brackets
It is a syntax for blank nodes.
Subject case
is equivalent to
Object case
is equivalent to
References
Last updated
Was this helpful?