Sparql: Parql Rotocol ND DF Uery Anguage
Sparql: Parql Rotocol ND DF Uery Anguage
Prof. Viswanathan V
School of Computing Science and Engineering
Vellore Institute of Technology
Chennai
SPARQL - Introduction
Querying with SPARQL
RDF Triples
stores
ex:raj a ex:Person ;
ex:dob "1980-05-27"^^xsd:date ; ex:knows "Java" ;
ex:name "Raj Kumar" ; ex:school ex:scope .
ex:ravi a ex:Person ;
ex:dob "1970-06-17"^^xsd:date ; ex:knows "Java" ;
ex:name "Ravichandaran" ; ex:school ex:smec .
ex:mary a ex:Person ;
ex:dob "2005-08-17"^^xsd:date ; ex:knows "Java" , "Python" ;
ex:name "Mary Joseph" ; ex:school ex:scope .
ex:radha a ex:Adult ;
ex:knows "Python" ; ex:name "Radha kumari" ; ex:school ex:sense .
Output :
raj is a answer...
?person ex:dob ?d
BIND(year(now()) - year(?d ) as ?age )
FILTER (?age > 17)
}
Example : This query returns an RDF graph that describes all the
persons who knows Python. OUTPUT :
@prefix ex: <http://www.vit.ac.in#> .
DESCRIBE ?x @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
WHERE @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
{ ex:radha a ex:Adult ;
ex:knows "Python" ;
?x ex:knows "Python" ex:name "Radha kumari" ;
ex:school ex:sense .
}
ex:mary a ex:Person ;
ex:dob "2005-08-17"^^xsd:date ;
ex:knows "Python" , "Java" ;
ex:name "Mary Joseph" ;
ex:school ex:scope .
ex:jayaram a ex:Person ;
ex:knows "Python" , "Java" ;
ex:name "Jayaram" ;
ex:school ex:smec .