Knowledge Representation VII - IKT507 This sentence is false! - - PowerPoint PPT Presentation

knowledge representation
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

1

Knowledge Representation

VII - IKT507

SPARQL stands for SPARQL Protocol And RDF Query Language

Jan Pettersen Nytun, UiA

This sentence is false!

slide-2
SLIDE 2

S O

P

Jan Pettersen Nytun, UiA, page 2

The Semantic Web Stack

Hierarchy of languages, where each layer exploits and uses capabilities of the layers below.

/ XML Schema

slide-3
SLIDE 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

slide-4
SLIDE 4
slide-5
SLIDE 5

5

slide-6
SLIDE 6

6

slide-7
SLIDE 7

7

slide-8
SLIDE 8

S O

P

A Simple Query [3]

Find the title of a book from the given data graph

  • Typically it contains a set of triple patterns called a basic graph

pattern, where subject, predicate and object may be a variable.

  • A basic graph pattern matches a subgraph of the RDF data

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"

slide-9
SLIDE 9

S O

P

Multiple Matches [3]

The following two subsets of the data provided the two matches:

slide-10
SLIDE 10

10

slide-11
SLIDE 11

11

slide-12
SLIDE 12

@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

Given Ontology - Example

slide-13
SLIDE 13

S O

P

Selecting All Triples

Jan Pettersen Nytun, UiA, Ontologies, page 13

slide-14
SLIDE 14

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

slide-15
SLIDE 15

S O

P

CONSTRUCT Statement

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. }

slide-16
SLIDE 16

S O

P

rdfs:subClassOf

The members of one class (the subclass) are also members of the other (the super class). Tools like reasoners “understands” the semantics of

  • subClassOf. It can also be described with SPARQL:

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 }

slide-17
SLIDE 17

S O

P

rdfs:subProperty Of

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 .

slide-18
SLIDE 18

S O

P

rdfs:subProperty Of

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 }

slide-19
SLIDE 19

S O

P

References

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