Note of SPARQL
Query Language
Link: SPAARQL 1.1 Query Language
Namespaces
前缀 Prefix
\quad
\quad
资源标识符IRI
rdf:
\quad
\quad
\quad
http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs:
\quad
\quad
\quad
http://www.w3.org/2000/01/rdf-schema#
xsd:
\quad
\quad
\quad
http://www.w3.org/2001/XMLSchema#
fn:
\quad
\quad
\quad
http://www.w3.org/2005/xpath-functions#
Sample tips
-
"cat"@en : lexical form “cat” 、language tag “en”
-
"42"^^xsd:integer : $datatype http://www.w3.org/2001/XMLSchema#integer
-
"abc"^^dt:specialDatatype: datatype http://example.org/datatype#specialDatatype
-
Language tags: $@ + language tag
-
Numeric Types: xsd:integer、xsd:float、 xsd:double
-
Blank Node: ‘-’
-
CONCAT(?G, " ", ?S): concatenate two variable
-
CONSTRUCT query: returns an RDF graph
-
regex: (FILTER function) matches only string literals
-
The following examples express the same query:
-
PREFIX dc: http://purl.org/dc/elements/1.1/
SELECT ?title
WHERE { http://example.org/book/book1 dc:title ?title } -
PREFIX dc: http://purl.org/dc/elements/1.1/
PREFIX : http://example.org/book/
SELECT $title
WHERE { :book1 dc:title $title } -
BASE http://example.org/book/
PREFIX dc: http://purl.org/dc/elements/1.1/
SELECT $title
WHERE { dc:title ?title }
-
-
“,”: share both subject and predicate
-
“;” : with a common subject
-
UNION:combines graph patterns
-
NOT EXISTS:testing for the absence of a pattern
-
EXISTS: testing for the presence of a pattern
-
MINUS: removing not compatible solution