Knowledge Representation VII - IKT507 This sentence is false! PARQL stands for PARQL Protocol And RDF Query Language Jan Pettersen Nytun, UiA 1
The emantic Web tack Hierarchy of languages, where each layer exploits and uses capabilities of the layers below. / XML chema Jan Pettersen Nytun, UiA, page 2
[4]: RDF provides a simple way to represent distributed data. The triple is the simplest way to represent a named connection between two things...the standard way to access RDF data uses a query language called PARQL PARQL query patterns are represented in a variant of Turtle. Jan Pettersen Nytun, UiA, page 3
5
6
7
A imple Query [3] Find the title of a book from the given data graph RDF data: <http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> "PARQL Tutorial".. Typically it contains a set of triple patterns called a basic graph pattern, where subject, predicate and object may be a variable. PARQL query: ELECT?title WHERE { Variable basic graph pattern <http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title>?title. } A basic graph pattern matches a subgraph of the RDF data when RDF terms from that subgraph may be substituted for the variables. Query result: title "PARQL Tutorial" Jan Pettersen Nytun, UiA, page 8
Multiple Matches [3] The following two subsets of the data provided the two matches:
10
11
Given ntology - Example @prefix : <http://www.semanticweb.org/janpn/ontologies/2014/8/parenthood#>.... <http://www.semanticweb.org/janpn/ontologies/2014/8/parenthood> rdf:type owl:ntology. :hason rdf:type owl:bjectproperty. :Female rdf:type owl:class ; rdfs:subclassf :Human. :Human rdf:type owl:class. :Male rdf:type owl:class ; rdfs:subclassf :Human. :HaraldVofNorway rdf:type owl:namedindividual ; rdfs:label "Harald V". Jan Pettersen Nytun, UiA,, page 12
electing All Triples Jan Pettersen Nytun, UiA, ntologies, page 13
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/xmlchema#> ELECT DITINCT?subject?predicate?object WHERE {?subject?predicate?object. } RDER BY?subject Jan Pettersen Nytun, UiA, ntologies, page 14
CNTRUCT tatement 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/xmlchema#> construct {?son :hasparent?father} WHERE {?father :hason?son. } Jan Pettersen Nytun, UiA, page 15
rdfs:subclassf The members of one class (the subclass) are also members of the other (the super class). :Female rdf:type owl:class ; rdfs:subclassf :Human. Tools like reasoners understands the semantics of subclassf. It can also be described with PARQL: construct {?resourse rdf:type?theuperclass} WHERE {?theubclass rdfs:subclassf?theuperclass.?resourse rdf:type?theubclass } Jan Pettersen Nytun, UiA, 16
rdfs:subproperty f The pair related by one property (the sub property) are included in the other (the super property). :hason rdf:type owl:bjectproperty ; rdfs:subpropertyf :isparentto. It can also be described with PARQL: Jan Pettersen Nytun, UiA, 17
rdfs:subproperty f The pair related by one property (the sub property) are included in the other (the super property). :hason rdf:type owl:bjectproperty ; rdfs:subpropertyf :isparentto. It can also be described with PARQL: construct {? subject?theuperproperty? object } WHERE {?theubproperty rdfs:subpropertyf?theuperproperty.?subject?theubproperty?object } Jan Pettersen Nytun, UiA, 18
References [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] PARQL Query Language for RDF, W3C Recommendation 15 January 2008 http://www.w3.org/tr/rdf-sparql-query/ [4] emantic Web for the Working ntologist, econd Edition: Effective Modeling in RDF and WL, May 20, 2011, by Dean Allemang, James Hendler Jan Pettersen Nytun, UIA, page 19