1
Knowledge Representation
VII - IKT507
SPARQL stands for SPARQL Protocol And RDF Query Language
Jan Pettersen Nytun, UiA
This sentence is false!
Knowledge Representation VII - IKT507 This sentence is false! - - PowerPoint PPT Presentation
Knowledge Representation VII - IKT507 This sentence is false! SPARQL stands for SPARQL Protocol And RDF Query Language Jan Pettersen Nytun, UiA 1 S O The Semantic Web Stack P Hierarchy of languages, where each layer exploits and uses
1
Jan Pettersen Nytun, UiA
This sentence is false!
S O
P
Jan Pettersen Nytun, UiA, page 2
Hierarchy of languages, where each layer exploits and uses capabilities of the layers below.
/ XML Schema
S O
P
Jan Pettersen Nytun, UiA, page 3
5
6
7
S O
P
Find the title of a book from the given data graph
pattern, where subject, predicate and object may be a variable.
when RDF terms from that subgraph may be substituted for the variables.
Jan Pettersen Nytun, UiA, page 8
RDF data:
<http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> "SPARQL Tutorial" ..
SPARQL query: SELECT ?title WHERE { <http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> ?title . } basic graph pattern Variable Query result: title "SPARQL Tutorial"
S O
P
The following two subsets of the data provided the two matches:
10
11
@prefix : <http://www.semanticweb.org/janpn/ontologies/2014/8/parenthood#> . ... <http://www.semanticweb.org/janpn/ontologies/2014/8/parenthood> rdf:type owl:Ontology . :hasSon rdf:type owl:ObjectProperty . :Female rdf:type owl:Class ; rdfs:subClassOf :Human . :Human rdf:type owl:Class . :Male rdf:type owl:Class ; rdfs:subClassOf :Human . :HaraldVofNorway rdf:type owl:NamedIndividual ; rdfs:label "Harald V" .
Jan Pettersen Nytun, UiA,, page 12
S O
P
Jan Pettersen Nytun, UiA, Ontologies, page 13
S O
P
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT DISTINCT ?subject ?predicate ?object WHERE { ?subject ?predicate ?object. }
ORDER BY ?subject
Jan Pettersen Nytun, UiA, Ontologies, page 14
S O
P
Jan Pettersen Nytun, UiA, page 15
PREFIX : <http://www.semanticweb.org/janpn/ontologies/2014/8/parenthood#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> construct { ?son :hasParent ?father} WHERE { ?father :hasSon ?son. }
S O
P
The members of one class (the subclass) are also members of the other (the super class). Tools like reasoners “understands” the semantics of
Jan Pettersen Nytun, UiA, 16
:Female rdf:type owl:Class ; rdfs:subClassOf :Human .
construct { ?resourse rdf:type ?theSuperClass} WHERE { ?theSubClass
rdfs:subClassOf
?theSuperClass. ?resourse rdf:type ?theSubClass }
S O
P
The pair related by one property (the sub property) are included in the other (the super property). It can also be described with SPARQL:
Jan Pettersen Nytun, UiA, 17
:hasSon rdf:type owl:ObjectProperty ; rdfs:subPropertyOf :isParentTo .
S O
P
The pair related by one property (the sub property) are included in the other (the super property). It can also be described with SPARQL:
Jan Pettersen Nytun, UiA, 18
:hasSon rdf:type owl:ObjectProperty ; rdfs:subPropertyOf :isParentTo .
construct { ? subject ?theSuperProperty ? object } WHERE { ?theSubProperty rdfs:subPropertyOf ?theSuperProperty . ?subject ?theSubProperty ?object }
S O
P
Jan Pettersen Nytun, UIA, page 19
[1] Book: David Poole and Alan Mackworth, Artificial Intelligence: Foundations of Computational Agents, Cambridge University Press, 2010, http://artint.info/ [2] http://www.w3.org/TR/swbp-n-aryRelations/ [3] SPARQL Query Language for RDF, W3C Recommendation 15 January 2008 http://www.w3.org/TR/rdf-sparql-query/ [4] Semantic Web for the Working Ontologist, Second Edition: Effective Modeling in RDFS and OWL, May 20, 2011, by Dean Allemang, James Hendler