knowledge representation
play

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. Knowledge Representation VII - IKT507 This sentence is false! SPARQL stands for SPARQL Protocol And RDF Query Language Jan Pettersen Nytun, UiA 1

  2. S O The Semantic Web Stack P Hierarchy of languages, where each layer exploits and uses capabilities of the layers below. / XML Schema Jan Pettersen Nytun, UiA, page 2

  3. S O P [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 SPARQL… SPARQL query patterns are represented in a variant of Turtle. Jan Pettersen Nytun, UiA, page 3

  4. 5

  5. 6

  6. 7

  7. A Simple Query [3] S O P 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> "SPARQL Tutorial" .. • Typically it contains a set of triple patterns called a basic graph pattern , where s u bject, predicate and object may be a variable. SPARQL query: Variable basic graph pattern SELECT ?title WHERE { <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 "SPARQL Tutorial" Jan Pettersen Nytun, UiA, page 8

  8. S O P Multiple Matches [3] The following two subsets of the data provided the two matches:

  9. 10

  10. 11

  11. Given Ontology - Example @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

  12. S Selecting All Triples O P Jan Pettersen Nytun, UiA, Ontologies, page 13

  13. S PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> O P 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

  14. S CONSTRUCT Statement O P 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. } Jan Pettersen Nytun, UiA, page 15

  15. S rdfs:subClassOf O P The members of one class (the subclass) are also members of the other (the super class). :Female rdf:type owl:Class ; rdfs:subClassOf :Human . Tools like reasoners “understands” the semantics of subClassOf. It can also be described with SPARQL: construct { ?resourse rdf:type ?theSuperClass} WHERE { ?theSubClass rdfs:subClassOf ?theSuperClass. ?resourse rdf:type ?theSubClass } Jan Pettersen Nytun, UiA, 16

  16. rdfs:subProperty S O P Of The pair related by one property (the sub property) are included in the other (the super property). :hasSon rdf:type owl:ObjectProperty ; rdfs:subPropertyOf :isParentTo . It can also be described with SPARQL: Jan Pettersen Nytun, UiA, 17

  17. rdfs:subProperty S O P Of The pair related by one property (the sub property) are included in the other (the super property). :hasSon rdf:type owl:ObjectProperty ; rdfs:subPropertyOf :isParentTo . It can also be described with SPARQL: construct { ? subject ?theSuperProperty ? object } WHERE { ?theSubProperty rdfs:subPropertyOf ?theSuperProperty . ?subject ?theSubProperty ?object } Jan Pettersen Nytun, UiA, 18

  18. S References O P [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 Jan Pettersen Nytun, UIA, page 19

Recommend


More recommend