807 B
807 B
SparQL
Note
Resources taken from this website
SQL Queries
SELECT
SELECT ?var1, ?var2, ...
WHERE
WHERE {
pattern1 .
pattern2 .
...
}
FILTER
It's used to restrict WHERE clauses
WHERE {
?person <http://example.com/hasCar> ?car .
FILTER (?car = <http://example.com/Car1>)
}
OPTIONAL
It's used to fetch available content if exists
SELECT ?person ?car
WHERE {
?person <http://example.com/hasCar> ?car .
OPTIONAL {
?car <http://example.com/hasColor> ?color .
}
}
LIMIT
Limits results
LIMIT 10 -- Take only 10 results
SparQL functions
COUNT
SELECT (COUNT(?person) AS ?count)
WHERE {
?person <http://example.com/hasCar> ?car .
}