Langages du Web de données et moteurs de recherche sémantique … · Langages du Web de données...

Post on 12-Sep-2018

215 views 0 download

Transcript of Langages du Web de données et moteurs de recherche sémantique … · Langages du Web de données...

Langages du Web de données et moteurs de recherche sémantique

Université Côte d’Azur

Inria, I3S, CNRSWimmics

olivier.corby@inria.fr

Agenda

1. Introduction

2. RDF

3. RDFS

4. SPARQL

5. Tools

6. Conclusion

Semantic Web of Data 2

W3C Web of Data

1. Semantic Web

2. Web of Data

3. Linked Data

Semantic Web of Data 3

Semantic Web of Data 4

Semantic Web of Data 5

6

Web

HTTP

URL

HTML

reference address

communication

WEB

7

Web of Data

HTTP

URI

RDF

reference address

communication

WEB

universal nodes and types

identification

Web of Data

• Web: Hypertext on top of the Internet (HTML)

• Web of Data: Semantic network on top of the Internet (RDF)

Semantic Web of Data 8

"Linking Open Data cloud diagram 2017, by Andrejs Abele, John P. McCrae, Paul Buitelaar, Anja Jentzsch and Richard Cyganiak. http://lod-cloud.net/"

Semantic Web of Data 9

LOD Cloud

W3C Core Web of Data

• RDF: Resource Description Framework

• RDFS: RDF Schema

• SPARQL: RDF Query Language

• OWL: Web Ontology Language

Semantic Web of Data 10

Agenda

1. Introduction

2. RDF

3. RDFS

4. SPARQL

5. Tools

6. Conclusion

Semantic Web of Data 11

RDF : Labeled Oriented Graph

Sophia_Antipolistype

Location

12Semantic Web of Data

Antibes

settlement

"Antibes"label

RDF Identifier : URI

<http://fr.dbpedia.org/resource/Sophia_Antipolis><http://www.w3.org/1999/02/22-rdf-syntax-ns#type><http://dbpedia.org/ontology/Location>

<http://fr.dbpedia.org/resource/Sophia_Antipolis><http://dbpedia.org/ontology/settlement> <http://fr.dbpedia.org/resource/Antibes>

<http://fr.dbpedia.org/resource/Antibes><http://www.w3.org/2000/01/rdf-schema#label>"Antibes"@fr

13Semantic Web of Data

RDF Identifier : URI

db:Sophia_Antipolis rdf:type onto:Location

db:Sophia_Antipolis onto:settlement db:Antibes

db:Antibes rdfs:label "Antibes"@fr

14Semantic Web of Data

RDF Identifier : URI

URL dereferencing

Execute HTTP request

Get an RDF graph

15Semantic Web of Data

RDF

• Triple– subject property object

• Binary relation– property(subject, object)

• Object oriented flavour– subject.property = object

• Type system– us:John rdf:type foaf:Person

– Multi instantiation

Semantic Web of Data 16

RDF term

• URI

• Blank Node

• Literal

• XSD datatype

– xs:int, xs:double, xs:boolean, xs:string , xs:date, etc.

Semantic Web of Data 17

RDF Syntax

• Turtle

• JSON LD

• RDF/XML

• Trig

• N3

• RDFa

Semantic Web of Data 18

graph ex:g1 { ex:James a ex:Lecturer ;

foaf:name "James" .}

graph ex:g2 { ex:James a ex:Musician ;

foaf:name "Jimmy" .}

Named Graph

19

Annotate Named Graph

graph ex:g1 { ex:James a ex:Lecturer ;

foaf:name "James" .}

ex:g1 ex:date "1930-01-29"^^xsd:date ;

ex:author ex:John .

20

Agenda

1. Introduction

2. RDF

3. RDFS

4. SPARQL

5. Tools

6. Conclusion

Semantic Web of Data 21

RDF Schema

• Define vocabulary for RDF

• RDF based

• Entailment oriented (not prescriptive)

• Class hierarchy: rdfs:subClassOf

• Multiple inheritance

• Property hierarchy: rdfs:subPropertyOf

• Property signature: rdfs:domain rdfs:range

Semantic Web of Data 22

rdfs:subClassOf

Entity

Person

Organization

University

Institute

RDF Schema

Semantic Web of Data 23

RDFS

rdfs:subClassOf

Entity

Person

Organization

University

Institute

member

rdfs:domain

rdfs:range

RDF Schema

Semantic Web of Data 24

signature

RDFS

rdfs:subClassOf

relation

Entity

Person

Organization

University

Institute

John CNRSmember

member

rdfs:domain

rdfs:range

RDF Schema

RDF

Semantic Web of Data 25

signature

RDF & RDFS

rdfs:subClassOf

rdf:type

relation

Entity

Person

Organization

University

Institute

John CNRSmember

member

rdfs:domain

rdfs:range

RDF Schema

RDF

Semantic Web of Data 26

signature

RDF & RDFS

rdf:type

relation

Person

Institute

John CNRSmember

RDF

Semantic Web of Data 27

RDF

relationJohn CNRSmember

RDF

Semantic Web of Data 28

RDF

Agenda

1. Introduction

2. RDF

3. RDFS

4. SPARQL

5. Tools

6. Conclusion

Semantic Web of Data 29

SPARQL

• RDF Query Language

• Query & Update

• Graph Pattern Matching

Semantic Web of Data 30

BGP: Basic Graph Pattern

?x a foaf:Person ;foaf:name ?name ;

foaf:knows ?y .

Semantic Web of Data 31

BGP: Basic Graph Pattern

?x a foaf:Person ;foaf:name ?name ;

foaf:knows ?y .

Semantic Web of Data 32

BGP: Basic Graph Pattern

?x a foaf:Person ;foaf:name ?name ;

foaf:knows ?y .

(1) ?x = ex:John ; ?name = "John" ; ?y = ex:Jack

(2) ?x = ex:Jack ; ?name = "Jack" ; ?y = ex:James

Semantic Web of Data 33

Filter

?x a foaf:Person ;foaf:name ?name ;

foaf:knows ?yfilter regex(?name, "John")

Semantic Web of Data 34

Select Query

select * where {?x a foaf:Person ;

foaf:name ?name ;

foaf:knows ?y .}

Semantic Web of Data 35

SPARQL Query Form

1. select where { BGP }

2. construct { BGP } where { BGP }

3. ask { BGP }

4. describe

Semantic Web of Data 36

Statement

• Basic Graph Pattern

• Named Graph Pattern

• Property Path

• Union

• Optional

• Minus

Semantic Web of Data 37

• Service

• Nested Query

• Bind

• Values

• Filter

• Having

Modifier

1. Select distinct, select expression

2. From, from named

3. Aggregate

4. Order by

5. Group by

6. Limit

7. Offset

Semantic Web of Data 38

Property Path

select * where {

?x rdf:type/rdfs:subClassOf* ?y

}

Semantic Web of Data 39

Service

select * where {

service <http://fr.dbpedia.org/sparql> {

?x rdfs:label "Antibes"@fr ; geo:lat ?lat ; geo:lon ?lon

}

}

Semantic Web of Data 40

SPARQL Update

• insert data { Graph }

• delete data { Graph }

• insert { BGP } where { BGP }

• delete { BGP } where { BGP }

• delete { BGP } insert { BGP } where { BGP }

• Load, Copy, Move, etc.

Semantic Web of Data 41

Web of Data W3C Ecosystem

RDF

RDFS

OWLSPARQL Query

SPARQLUpdate

SKOS

SHACL

42Semantic Web of Data

OWL

• Web Ontology Language

• Description Logics for RDF

• Define classes, properties and their logicalrelations

• Intersection, union, complement, restriction

• Transitivity, Symmetry, etc.

Semantic Web of Data 43

SKOS

• Simple Knowledge Organization System

• Thesaurus

• Natural Language

• Define terms and their linguistic relations

Semantic Web of Data 44

SHACL

• Shapes Constraint Language

• Define constraints for RDF graph

• Enables users to validate RDF graph

Semantic Web of Data 45

Agenda

1. Introduction

2. RDF

3. RDFS

4. SPARQL

5. Tools

6. Conclusion

Semantic Web of Data 46

Tools

• Virtuoso

• Jena

• Corese

• Sparklis

Semantic Web of Data 47

Virtuoso

• Openlink• Data Base generic platform (relational, XML, RDF) • SPARQL endpoint• Linked Data• Scale the Web of Data• DBpedia

– fr dbpedia: 185 404 501 triples– en dbpedia: 438 336 517 triples

• Manages billions of triples

http://virtuoso.openlinksw.com/rdf/

Semantic Web of Data 48

Semantic Web of Data 49

Semantic Web of Data 50

Semantic Web of Data 51

Jena

• « Academic » reference implementation

• Apache

• Open Source

• Java

• Fuseki: SPARQL Endpoint

• TDB: persistent triple store

• Java API for RDF and OWL

https://jena.apache.org/

Semantic Web of Data 52

Jena

• Transitive reasoner

• RDFS rule reasoner

• OWL rule reasoners (subsets of OWL)

• Possibility to use Pellet, Racer or FaCT

• Consistency checking

• Rule based reasoner: forward, backward chaining

• Generate SPARQL algebra

https://jena.apache.org/

Semantic Web of Data 53

Jena Rules

Semantic Web of Data 54

(?p rdfs:subPropertyOf ?q), notEqual(?p,?q)

->

[ (?a ?q ?b) <- (?a ?p ?b) ] .

Corese

• Wimmics, Inria

• Inference Rule Language

• STTL: SPARQL Template Transformation Language

• LDScript: Linked Data Script Language

• SPARQL approximate search

• Web server with transformations

– Hypertext on Linked Data

Semantic Web of Data 55

Inference Rule Language

• SPARQL based

• construct { BGP } where { BGP }

• Forward chaining inference engine

• OWL RL

Semantic Web of Data 56

STTL

• Transformation Language for RDF à la XSLT

• SPARQL based

1. template { Text Pattern } where { BGP }

2. transformation = set of templates

3. st:apply-templates, st:call-template

Semantic Web of Data 57

LDScript

• Linked Data Script Language

• Define SPARQL extension functions

function us:fac(?n) { if (?n = 0, 1, ?n * us:fac(?n – 1))

}

Semantic Web of Data 58

LDScript

• Query in function

• Second order functions: map, funcall, reduce

• Lambda expression

• Pattern matching

• Statements: let, for, return

• Extension datatypes:

– dt:graph, dt:triple, dt:mapping, dt:list

Semantic Web of Data 59

LDScript

function us:type(?x) {let ( select * where { ?x a ?t } ) { ?t }

}

Semantic Web of Data 60

Development environment

SPARQL Template Transformation Language 61

SPARQL Template Transformation Language 62

SPARQL Template Transformation Language 63

64

Sparklis

• Inria Nancy, SemLIS, Sébastien Ferré

• http://www.irisa.fr/LIS/ferre/sparklis/

• SPARQL query structured editor

• Select a SPARQL endpoint

– http://fr.dbpedia.org/sparql

• Formalized «Natural» Language

Semantic Web of Data 65

Sparklis

• Faceted search

• Browse the triple store

• Propose relevant types and properties

• Propose suggestions to refine query at givenfocus

• Display the SPARQL query

Semantic Web of Data 66

Semantic Web of Data 67

Semantic Web of Data 68

Semantic Web of Data 69

Semantic Web of Data 70

Semantic Web of Data 71

Other tools

• Oracle Spatial and RDF Semantic Graph

• AllegroGraph, FranzInc

• RDF4J (ex Sesame), Eclipse

• SWI-Prolog for the (semantic) web

– http://www.swi-prolog.org/web/

Semantic Web of Data 72

SPARQL Endpoint

• http://fr.dbpedia.org/sparql• http://dbpedia.org/sparql• http://data.archives-ouvertes.fr/sparql• http://data.insee.fr/sparql• http://data.bnf.fr/sparql• http://semantic.eea.europa.eu/sparql• http://data.linkedmdb.org/sparql?query=...• http://geosparql.org/

http://www.w3.org/wiki/SparqlEndpoints

Semantic Web of Data 73

Web of Data vs KRR and AI

• W3C provides Knowledge Representation and Reasoning with standards

• An external actor succeeded to unify a « scattered » research domain

• Contributes to « industrialize » and scale KRR

• Interoperable Knowledge Bases on the Web

Semantic Web of Data 74

Web of Data vs KRR and AI

New research problems

• Ontology design and sharing for world widecommunities

• Ontology matching

• Scaling KR and entailment

• Federated query processing

• Data quality

Semantic Web of Data 75

Conclusion

• Semantic Web of Linked Data

• W3C standards

• Semantic Network at the scale of the Internet

• Distributed Knowledge Base

• Interoperable implementations

Towards the Web of Knowledge

Semantic Web of Data 76