Académique Documents
Professionnel Documents
Culture Documents
goasdoue
Francois Goasdoue
Univ. Paris-Sud
24 avril 2013
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 1 / 103
Introduction au Web Semantique
Le Web Semantique en quelques mots. . .
Idee : ajouter une description semantique des donnees du Web an de
faciliter leur exploitation (interrogation ou comparaison,. . . ).
le Web Semantique permet lexploitation semantique de donnees alors
que le Web classique permet dexploiter structurellement les donnees.
Pourquoi ?
Les donnees du Web sont decrites uniquement de facon structurelle :
HTML (statique ou dynamique) : texte libre formate
Texte
Pprod nom
ref Pprod ref
Texte
Pprod ref
prix Pprod prix
Texte
Pprod prix
Pconsole Pcult Plect bd dvd Phi
Pbd dvd Pcult Ptv Phi
compatible Pbd dvd compatible
Plect bd dvd
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 5 / 103
Introduction au Web Semantique
Le Web Semantique en quelques mots. . .
Indexation de pages Web en termes de lontologie
Pbd dvd(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition)
nom(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,9.98)
compatible(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,http ://www.amazon.fr/Console-Playstation-3-80-
Go)
. . .
Pconsole(http ://www.amazon.fr/Console-Playstation-3-80-Go)
nom(http ://www.amazon.fr/Console-Playstation-3-80-Go,Playstation 3)
prix(http ://www.amazon.fr/Console-Playstation-3-80-Go,450)
. . .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 6 / 103
Introduction au Web Semantique
Le Web Semantique en quelques mots. . .
Interrogation semantique de donnees en termes de lontologie
Quels sont les DVD/Blu-ray `a moins de 20 euros compatibles avec la
PS3 ? Q(d) : bd dvd(d) prix(d, p) p 20 compatible(d, l ) nom(l , Playstation 3)
d=http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition
d=http ://www.amazon.fr/Harry-potter-lecole-sorciers-Blu-ray
. . .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 7 / 103
Introduction au Web Semantique
Le Web Semantique en quelques mots. . .
Interrogation semantique de donnees en termes de lontologie
Quels sont les noms et references des produits hi `a moins de 500 euros ?
Q(n, r ) : Phi(ph) nom(ph, n) ref (ph, r ) prix(ph, p) p 500
n=Playstation 3 et r=B00005R6XJ
n=Philips - 32PFL5403D/12 et r=B001ANOX7C
. . .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 8 / 103
Introduction au Web Semantique
Le Web Semantique en quelques mots. . .
Interet du Web Semantique
`
A partir de donnees decrites structurellement sur le Web, on peut
construire leur description semantique grace `a une ontologie. Ceci permet
de poser des requetes naturelles pour un utilisateur lambda, alors
quobtenir les memes informations en interrogeant les donnees par leur
structure serait impossible (HTML) ou tr`es dicile (XML).
Pour mettre en uvre le Web Semantique, plusieurs probl`emes se posent
et doivent donc etre etudies theoriquement et algorithmiquement.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 9 / 103
Introduction au Web Semantique
Le Web Semantique en quelques mots. . .
Les enjeux du Web Semantique
Comment construire une ontologie ?
Comment garantir un certain niveau de qualite pour une ontologie ?
Edition compatible
http ://www.amazon.fr/Console-Playstation-3-80-Go .
. . .
http ://www.amazon.fr/Console-Playstation-3-80-Go rdf :type Console .
http ://www.amazon.fr/Console-Playstation-3-80-Go name Playstation 3 .
http ://www.amazon.fr/Console-Playstation-3-80-Go price 450 .
http ://www.amazon.fr/Console-Playstation-3-80-Go redPrice 399 .
. . .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 14 / 103
RDF querying (by example)
SPARQL querying
Which DVDs/Blu-rays cost less than 20 euros and are compatible with the
PS3 ?
SELECT ?d FROM db WHERE { ?d rdf:type Bd dvd . ?d price ?p . ?d compatible ?pl . ?pl
name "Playstation 3" . FILTER(?p 20) }
---
?d
---
http://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition
http://www.amazon.fr/Harry-potter-lecole-sorciers-Blu-ray
...
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 15 / 103
RDF querying (by example)
SPARQL querying needs reasoning !
What are the names and references of Hi products that cost less than
400 euros ?
SELECT ?n ?r FROM db WHERE { ?hp rdf:type HifiP . ?hp name ?n . ?hp ref ?r . ?hp
price ?p . FILTER(?p 400) }
------
?n ?r
------
"Playstation 3" "B00005R6XJ"
...
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 16 / 103
Outline of the course about RDF
1
The RDF data model
2
The SPARQL query language
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 17 / 103
The RDF data model
The RDF data model allows writting labeled graph using triples.
Denition (Triple)
A triple is made of three components :
1
a subject : URI or a blank node (unnamed URI)
2
a property or predicate : URI
3
an object : URI, blank node, or literal (string)
A triple is written : subject property object .
Denition (Graph)
An RDF graph is a set of triples (a database).
Its nodes are (labeled with) the subjects and objects of the triples.
Its edges are (labeled with) the properties of the triples.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 18 / 103
The RDF data model
Graph of an RDF database
http://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition compatible
http://www.amazon.fr/Console-Playstation-3-80-Go .
http://www.amazon.fr/Console-Playstation-3-80-Go rdf:type Console .
http://www.amazon.fr/Console-Playstation-3-80-Go name "Playstation 3" .
http://www.amazon.fr/Console-Playstation-3-80-Go price "450" .
http://www.amazon.fr/Console-Playstation-3-80-Go redPrice "399" .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 19 / 103
The RDF data model
Graph of an RDF/XML database
<?xml v e r s i o n =1.0?>
<r d f : RDF xml ns : r d f =ht t p : //www. w3 . or g /1999/02/22r df s ynt axns# xml ns=ht t p : //www. l r i . f r#>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEd i t i o n>
<r d f : t ype r d f : r e s o ur c e=ht t p : //www. l r i . f r#Bd dvd/>
<name>Le f a bul e ux d e s t i n d Amel i e Poul ai n </name>
<pr i c e >9.98</ pr i c e >
<c ompat i bl e r d f : r e s o ur c e=ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go/>
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go>
<r d f : t ype r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cons ol e/>
<name>Pl a y s t a t i o n 3</name>
<pr i c e >450</pr i c e >
<r e dPr i c e >399</r e dPr i c e>
</r d f : De s c r i pt i on>
</r d f : RDF>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 20 / 103
RDF data model
Note that from a logical viewpoint, a triple is a fact (in the rst order logic
sense) and a RDF graph is a set of facts.
Graph of an RDF database
RDF :
http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition compatible
http ://www.amazon.fr/Console-Playstation-3-80-Go .
http ://www.amazon.fr/Console-Playstation-3-80-Go rdf :type Console .
http ://www.amazon.fr/Console-Playstation-3-80-Go name Playstation 3 .
http ://www.amazon.fr/Console-Playstation-3-80-Go price 450 .
http ://www.amazon.fr/Console-Playstation-3-80-Go redPrice 399 .
FOL :
Bd dvd(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition)
name(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition, 9.98)
compatible(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,
http ://www.amazon.fr/Console-Playstation-3-80-Go)
Console(http ://www.amazon.fr/Console-Playstation-3-80-Go)
name(http ://www.amazon.fr/Console-Playstation-3-80-Go, Playstation 3)
price(http ://www.amazon.fr/Console-Playstation-3-80-Go, 450)
redPrice(http ://www.amazon.fr/Console-Playstation-3-80-Go, 399)
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 21 / 103
The RDF data model
An RDF database can have a schema.
Denition (Schema)
The schema of an RDF database states the semantic relationships that
hold between the classes and properties to which the data belongs.
The an RDF schema allows dening four semantic relationships.
Semantic relationship RDFS notation FOL notation Relational notation
Class inclusion C
1
rdfs :subClassOf C
2
. X(C
1
(X) C
2
(X)) C
1
C
2
Property inclusion P
1
rdfs :subPropertyOf P
2
. XY(P
1
(X, Y) P
2
(X, Y)) P
1
P
2
Domain typing of a property P rdfs :domain C . XY(P(X, Y) C(X))
domain
(P) C
Range typing of a property P rdfs :range C . XY(P(X, Y) C(Y))
range
(P) C
WARNING!
In contrast with the relational data model, RDFS relationships are not
integrity constraints enforced in the database (see next slides).
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 22 / 103
RDF data model
RDF schema for e-commerce
CultP rdfs :subClassOf Prod . name rdfs :domain Prod .
Concole rdfs :subClassOf CultP . name rdfs :range rdf :Literal .
Bd dvd rdfs :subClassOf CultP . ref rdfs :domain Prod .
HihiP rdfs :subClassOf Prod . ref rdfs :range rdf :Literal .
Bd dvd player rdfs :subClassOf HihiP . price rdfs :domain Prod .
Tv rdfs :subClassOf HihiP . price rdfs :range rdf :Literal .
compatible rdfs :domain Bd dvd . redPrice rdfs :subProperty price .
compatible rdfs :range Bd dvd player .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 23 / 103
RDF data model
RDF schema for e-commerce
<?xml v e r s i o n =1.0?>
<r d f : RDF xml ns : r d f =ht t p : //www. w3 . or g /1999/02/22r df s ynt axns#
xml ns : r d f s =ht t p : //www. w3 . or g /2000/01/ r df schema#
xml ns=ht t p : //www. l r i . f r#>
<r d f s : Cl a s s r d f : about=ht t p : //www. l r i . f r#Cul tP>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Prod/>
</r d f s : Cl as s>
<r d f s : Cl a s s r d f : about=ht t p : //www. l r i . f r#Cons ol e>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cul tP/>
</r d f s : Cl as s>
<r d f s : Pr oper t y r d f : about=ht t p : //www. l r i . f r#p r i c e>
<r d f s : domai n r d f : r e s o ur c e=ht t p : //www. l r i . f r#Prod/>
<r d f s : r ange r d f : r e s o ur c e=ht t p : //www. w3 . or g /1999/02/22r df s ynt axns#L i t e r a l />
</r d f s : Pr oper t y>
<r d f s : Pr oper t y r d f : about=ht t p : //www. l r i . f r#r e d Pr i c e>
<r d f s : s ubPr oper t yOf r d f : r e s o ur c e=ht t p : //www. l r i . f r#p r i c e />
</r d f s : Pr oper t y>
<r d f s : Cl a s s r d f : about=ht t p : //www. l r i . f r#Bd dvd>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cul tP/>
</r d f s : Cl as s>
</r d f : RDF>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 24 / 103
RDF data model
RDF schema for e-commerce
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 25 / 103
The RDF data model
RDF database for e-commerce : schema statements are not ICs
http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition compatible
http ://www.amazon.fr/Console-Playstation-3-80-Go .
http ://www.amazon.fr/Console-Playstation-3-80-Go rdf :type Console .
http ://www.amazon.fr/Console-Playstation-3-80-Go name Playstation 3 .
http ://www.amazon.fr/Console-Playstation-3-80-Go price 450 .
http ://www.amazon.fr/Console-Playstation-3-80-Go redPrice 399 .
http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition compatible
http ://www.amazon.fr/Console-Playstation-3-80-Go .
http ://www.amazon.fr/Console-Playstation-3-80-Go rdf :type Console .
http ://www.amazon.fr/Console-Playstation-3-80-Go name Playstation 3 .
http ://www.amazon.fr/Console-Playstation-3-80-Go price 450 .
http ://www.amazon.fr/Console-Playstation-3-80-Go redPrice 399 .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 27 / 103
The RDF data model
To make explicit all the implicit triples of a database, we can saturate it.
One can saturate :
the schema
does not make much sense, except for asking queries at the schema
level
the data based on its associated schema
Edition compatible
http ://www.amazon.fr/Console-Playstation-3-80-Go .
http ://www.amazon.fr/Console-Playstation-3-80-Go rdf :type Console .
http ://www.amazon.fr/Console-Playstation-3-80-Go name Playstation 3 .
http ://www.amazon.fr/Console-Playstation-3-80-Go price 450 .
http ://www.amazon.fr/Console-Playstation-3-80-Go redPrice 399 .
The saturation of the dataset wrt the schema adds (among other triples) :
http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition compatible
http://www.amazon.fr/Console-Playstation-3-80-Go .
http://www.amazon.fr/Console-Playstation-3-80-Go rdf:type Console .
http://www.amazon.fr/Console-Playstation-3-80-Go name "Playstation 3" .
http://www.amazon.fr/Console-Playstation-3-80-Go price "450" .
http://www.amazon.fr/Console-Playstation-3-80-Go redPrice "399" .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 37 / 103
RDF/XML
Graph of an RDF/XML database
<?xml v e r s i o n =1.0?>
<r d f : RDF xml ns : r d f =ht t p : //www. w3 . or g /1999/02/22r df s ynt axns# xml ns=ht t p : //www. l r i . f r#>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEd i t i o n>
<r d f : t ype r d f : r e s o ur c e=ht t p : //www. l r i . f r#Bd dvd/>
<name>Le f a bul e ux d e s t i n d Amel i e Poul ai n </name>
<pr i c e >9.98</ pr i c e >
<c ompat i bl e r d f : r e s o ur c e=ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go/>
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go>
<r d f : t ype r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cons ol e/>
<name>Pl a y s t a t i o n 3</name>
<pr i c e >450</pr i c e >
<r e dPr i c e >399</r e dPr i c e>
</r d f : De s c r i pt i on>
</r d f : RDF>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 38 / 103
RDF/XML
Graph of an RDF schema
CultP rdfs :subClassOf Prod . name rdfs :domain Prod .
Concole rdfs :subClassOf CultP . name rdfs :range rdf :Literal .
Bd dvd rdfs :subClassOf CultP . ref rdfs :domain Prod .
HihiP rdfs :subClassOf Prod . ref rdfs :range rdf :Literal .
Bd dvd player rdfs :subClassOf HihiP . price rdfs :domain Prod .
Tv rdfs :subClassOf HihiP . price rdfs :range rdf :Literal .
compatible rdfs :domain Bd dvd . redPrice rdfs :subProperty price .
compatible rdfs :range Bd dvd player .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 39 / 103
RDF/XML
Graph of an RDF/XML schema
<?xml v e r s i o n =1.0?>
<r d f : RDF xml ns : r d f =ht t p : //www. w3 . or g /1999/02/22r df s ynt axns#
xml ns : r d f s =ht t p : //www. w3 . or g /2000/01/ r df schema#
xml ns=ht t p : //www. l r i . f r#>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. l r i . f r#Cul tP>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Prod/>
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. l r i . f r#Cons ol e>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cul tP/>
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. l r i . f r#p r i c e>
<r d f s : domai n r d f : r e s o ur c e=ht t p : //www. l r i . f r#Prod/>
<r d f s : r ange r d f : r e s o ur c e=ht t p : //www. w3 . or g /1999/02/22r df s ynt axns#L i t e r a l />
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. l r i . f r#r e d Pr i c e>
<r d f s : s ubPr oper t yOf r d f : r e s o ur c e=ht t p : //www. l r i . f r#p r i c e />
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. l r i . f r#Bd dvd>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cul tP/>
</r d f : De s c r i pt i on>
</r d f : RDF>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 40 / 103
RDF/XML
About blank nodes
A blank node is created whenever rdf:nodeID=label is used in
place of rdf:about=URI as the subject of a triple (i.e., in an
rdf :Description) or rdf:resource=label as the object of a triple
(i.e., in a property).
How to use rdf:nodeID ?
<?xml v e r s i o n =1.0?>
<r d f : RDF xml ns : r d f =ht t p : //www. w3 . or g /1999/02/22r df s ynt axns# xml ns=ht t p : //www. l r i . f r#>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEd i t i o n>
<r d f : t ype r d f : r e s o ur c e=ht t p : //www. l r i . f r#bd dvd/>
<name>Le f a bul e ux d e s t i n d Amel i e Poul ai n </name>
<pr i c e >9.98</ pr i c e >
<c ompat i bl e r d f : nodeI D=xbox/>
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : nodeI D=xbox>
<r d f : t ype r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cons ol e/>
<name>XBOX 360</name>
<pr i c e >249</pr i c e >
<r e dPr i c e >179</r e dPr i c e>
</r d f : De s c r i pt i on>
</r d f : RDF>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 41 / 103
RDF/XML-ABBREV
A more compact notion of RDF/XML exists : RDF/XML-ABBREV.
RDF/XML-ABBREV
In that notation, rdf:Description is replaced by a type of the
description.
RDF data in RDF/XML
<?xml v e r s i o n =1.0?>
<r d f : RDF xml ns : r d f =ht t p : //www. w3 . or g /1999/02/22r df s ynt axns# xml ns=ht t p : //www. l r i . f r#>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEd i t i o n>
<r d f : t ype r d f : r e s o ur c e=ht t p : //www. l r i . f r#Bd dvd/>
<name>Le f a bul e ux d e s t i n d Amel i e Poul ai n </name>
<pr i c e >9.98</ pr i c e >
<c ompat i bl e r d f : r e s o ur c e=ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go/>
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go>
<r d f : t ype r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cons ol e/>
<name>Pl a y s t a t i o n 3</name>
<pr i c e >450</pr i c e >
<r e dPr i c e >399</r e dPr i c e>
</r d f : De s c r i pt i on>
</r d f : RDF>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 42 / 103
RDF/XML-ABBREV
RDF data in RDF/XML-ABBREV
<?xml v e r s i o n =1.0?>
<r d f : RDF
xml ns : r d f =ht t p : //www. w3 . or g /1999/02/22r df s ynt axns#
xml ns=ht t p : //www. l r i . f r#>
<Bd dvd r d f : about=ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEd i t i o n>
<c ompat i bl e r d f : r e s o ur c e=ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go/>
<pr i c e >9.98</ pr i c e >
<name>Le f a bul e ux d e s t i n d Amel i e Poul ai n </name>
</Bd dvd>
<Cons ol e r d f : about=ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go>
<r e dPr i c e >399</r e dPr i c e>
<pr i c e >450</pr i c e >
<name>Pl a y s t a t i o n 3</name>
</Consol e>
</r d f : RDF>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 43 / 103
RDF/XML-ABBREV
RDF schema in RDF/XML
<?xml v e r s i o n =1.0?>
<r d f : RDF xml ns : r d f =ht t p : //www. w3 . or g /1999/02/22r df s ynt axns#
xml ns : r d f s =ht t p : //www. w3 . or g /2000/01/ r df schema#
xml ns=ht t p : //www. l r i . f r#>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. l r i . f r#Cul tP>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Prod/>
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. l r i . f r#Cons ol e>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cul tP/>
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. l r i . f r#p r i c e>
<r d f s : domai n r d f : r e s o ur c e=ht t p : //www. l r i . f r#Prod/>
<r d f s : r ange r d f : r e s o ur c e=ht t p : //www. w3 . or g /1999/02/22r df s ynt axns#L i t e r a l />
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. l r i . f r#r e d Pr i c e>
<r d f s : s ubPr oper t yOf r d f : r e s o ur c e=ht t p : //www. l r i . f r#p r i c e />
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. l r i . f r#Bd dvd>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cul tP/>
</r d f : De s c r i pt i on>
</r d f : RDF>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 44 / 103
RDF/XML-ABBREV
RDF schema in RDF/XML-ABBREV
<?xml v e r s i o n =1.0?>
<r d f : RDF xml ns : r d f =ht t p : //www. w3 . or g /1999/02/22r df s ynt axns#
xml ns : r d f s =ht t p : //www. w3 . or g /2000/01/ r df schema#
xml ns=ht t p : //www. l r i . f r#>
<r d f s : Cl a s s r d f : about=ht t p : //www. l r i . f r#Cul tP>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Prod/>
</r d f s : Cl as s>
<r d f s : Cl a s s r d f : about=ht t p : //www. l r i . f r#Cons ol e>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cul tP/>
</r d f s : Cl as s>
<r d f s : Pr oper t y r d f : about=ht t p : //www. l r i . f r#p r i c e>
<r d f s : domai n r d f : r e s o ur c e=ht t p : //www. l r i . f r#Prod/>
<r d f s : r ange r d f : r e s o ur c e=ht t p : //www. w3 . or g /1999/02/22r df s ynt axns#L i t e r a l />
</r d f s : Pr oper t y>
<r d f s : Pr oper t y r d f : about=ht t p : //www. l r i . f r#r e d Pr i c e>
<r d f s : s ubPr oper t yOf r d f : r e s o ur c e=ht t p : //www. l r i . f r#p r i c e />
</r d f s : Pr oper t y>
<r d f s : Cl a s s r d f : about=ht t p : //www. l r i . f r#Bd dvd>
<r d f s : s ubCl as s Of r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cul tP/>
</r d f s : Cl as s>
</r d f : RDF>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 45 / 103
RDF/XML(-ABBREV)
The XML notations of RDF allow enforcing type checking on literals using
the property rdf :datatype.
How to use data types ?
A data type is specied in the triple notation using s p o^^URI, where
URI is the URI of the desired XML Schema data type.
The corresponding RDF/XML notation is :
<rdf:Description rdf:about=s>
<p rdf:datatype=URI>string</p>
</rdf:Description>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 46 / 103
RDF/XML(-ABBREV)
Using data types in RDF data
ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEd i t i o n r d f : t ype Bd dvd .
ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEd i t i o n
name Le f a bul e ux d e s t i n d Amel i e Poul ai n .
ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEd i t i o n
p r i c e 9.98<ht t p : //www. w3 . or g /2001/XMLSchema#f l o a t > .
ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEdi t i o n
c ompat i bl e ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go .
ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go r d f : t ype Cons ol e .
ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go name Pl a y s t a t i o n 3 .
ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go
p r i c e 450<ht t p : //www. w3 . or g /2001/XMLSchema#f l o a t > .
ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go
r e d Pr i c e 399<ht t p : //www. w3 . or g /2001/XMLSchema#f l o a t > .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 47 / 103
RDF/XML(-ABBREV)
Using data types in RDF/XML data
<?xml v e r s i o n =1.0?>
<r d f : RDF xml ns : r d f =ht t p : //www. w3 . or g /1999/02/22r df s ynt axns# xml ns=ht t p : //www. l r i . f r#>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEd i t i o n>
<r d f : t ype r d f : r e s o ur c e=ht t p : //www. l r i . f r#Bd dvd/>
<name>Le f a bul e ux d e s t i n d Amel i e Poul ai n </name>
<p r i c e r d f : dat at ype=ht t p : //www. w3 . or g /2001/XMLSchema#f l o a t >9.98</ pr i c e >
<c ompat i bl e r d f : r e s o ur c e=ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go/>
</r d f : De s c r i pt i on>
<r d f : De s c r i p t i o n r d f : about=ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go>
<r d f : t ype r d f : r e s o ur c e=ht t p : //www. l r i . f r#Cons ol e/>
<name>Pl a y s t a t i o n 3</name>
<p r i c e r d f : dat at ype=ht t p : //www. w3 . or g /2001/XMLSchema#f l o a t >450</pr i c e >
<r e d Pr i c e r d f : dat at ype=ht t p : //www. w3 . or g /2001/XMLSchema#f l o a t >399</r e dPr i c e>
</r d f : De s c r i pt i on>
</r d f : RDF>
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 48 / 103
The SPARQL query language
SPARQL (SPARQL Protocol and RDF Query Language) is a W3C
recommendation since 2008.
SPARQL Protocol and RDF Query Language
The SPARQL recommendation contains both a protocol to access remote
RDF data and a query language.
WARNING!
In this course, we focus on the RDF query language only.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 49 / 103
The SPARQL query language
From a theoretical viewpoint, SPARQL mainly models a restriction of rst
order logic (FOL) queries over a single relation : the saturated triple table.
FOL query
A query if a FOL formula ( x), where x is the (possibly empty) set of the
free variables in (those that are not quantied). The arity of a query is
the cardinality of x, e.g., 0 for a boolean query (a yes/no query).
Triple table
The triple table t(s, p, o) is a table that stored RDF triples, where the s,
p, o attributes respectively denote the subject, property, and object for a
triple/tuple.
SPARQL queries FOL queries
SPARQL has the expressive power of the relational algebra.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 50 / 103
The SPARQL query language
FOL query answering
The answer set of a query Q : ( x) of arity n 1 against a dataset T is
ans(Q, T) =
t (
n
[ T [= ( x)
[ x
t]
and ( is the set of constant
occuring in T.
By convention, when Q : ( x) is boolean ( x is empty)
ans(Q, T) = true if T [= ()
ans(Q, T) = false otherwise.
RDF/SPARQL vs FOL query answering
Let Q : ( x) be a SPARQL query (thus a FOL query) and T an RDF
dataset associated to a schema o.
The answer set of Q wrt the database o, T, denoted ans(Q, o, T), is :
ans(Q, saturate(o, T)).
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 51 / 103
The SPARQL query language
Saturated triple table for the e-commerce example
t s p o
http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
a conjunction of graphs g
1
g
n
that must appear in the data.
a union de graphs g
1
UNION UNION g
n
one of which must
appear in the data.
| pr od | p r i c e |
================
w/ s a t u r a t i o n :
| pr od | p r i c e |
===========================================================================
| <ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go> | 399 |
| <ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go> | 450 |
| <ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEdi t i on> | 9. 98 |
| pr od | p r i c e |
================
w/ s a t u r a t i o n :
| pr od
| p r i c e |
=====================================================================================================================
| <ht t p : //www. amazon . f r / Fabul euxde s t i ndAmel i ePoul ai nEdi t i on> | 9.98<ht t p : //www. w3 . or g /2001/XMLSchema#f l o a t > |
| <ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go>
| 399<ht t p : //www. w3 . or g /2001/XMLSchema#f l o a t > |
| pr od | p r i c e |
================
w/ s a t u r a t i o n :
| pr od
| p r i c e |
=====================================================================================================================
| <ht t p : //www. amazon . f r / Consol ePl a y s t a t i on 380Go>
| 399<ht t p : //www. w3 . or g /2001/XMLSchema#f l o a t > |
.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 72 / 103
DL-lite
1
Syntaxe des formules de DL-lite
R
Enn, ces concepts et roles de base servent `a construire des concepts et
roles generaux.
Syntaxe des concepts et roles generaux
Un concept general C est un concept de base B ou sa negation B.
Un role general E est un role de base R ou sa negation R.
Maintenant que nous avons une syntaxe pour les formules de DL-lite
R
(c`ad pour les concepts et roles de DL-lite
R
), il faut leur associer un
sens (c`ad ce que modelise ces formules) !
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 73 / 103
DL-lite
1
Semantique des formules de DL-lite
R
La semantique des formules de DL-lite
R
se denit inductivement `a partir
de la semantique des concepts et roles atomiques.
Semantique des concepts et r oles atomiques
La semantique des concepts et roles atomiques est donnee en termes
dinterpretations logiques. Une interpretation logique I est un couple
(
I
, .
I
), o` u
I
est un ensemble dobjets appele domaine dinterpretation
et .
I
est une fonction dinterpretation qui associe :
un sous ensemble de
I
`a tout concept atomique A : A
I
I
une relation binaire sur
I
`a tout role atomique P : P
I
I
I
.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 74 / 103
DL-lite
1
Semantique des formules de DL-lite
R
La semantique des concepts et roles de base et generaux de DL-lite
R
se
denit inductivement `a partir de la semantique des concepts et roles
atomiques.
Semantique des concepts et r oles de base et generaux
concept atomique A : A
I
I
role atomique P : P
I
I
I
role inverse P
: (x, y) [ (y, x) P
I
I
R
I
Mod`ele dune relation et relation satisable
Une interpretation I est un mod`ele dune relation r ssi r
I
,= .
Une relation r est satisable ssi elle a un mod`ele.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 75 / 103
DL-lite
1
Syntaxe des Tboxes de DL-lite
R
Dans DL-lite
R
, les Tbox sont faites dinclusions entre concepts de la
forme B _ C et dinclusions entre roles de la forme R _ E.
Attention !
Les relations (concepts ou roles) en partie gauche dune inclusion sont
necessairement de base ! Seules les relations en partie droite dune
inclusion sont generales !
Inclusions positives et negatives
On distingue les inclusions positives (PI) et les inclusions negative (NI) :
une PI est de la forme B
1
_ B
2
ou R
1
_ R
2
une NI est de la forme B
1
_ B
2
ou R
1
_ R
2
Une PI modelise une inclusion entre concepts (resp. roles) alors quune NI
modelise deux concepts (resp. roles) disjoints.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 76 / 103
DL-lite
1
Semantique des Tboxes de DL-lite
R
Les PI et NI sont des contraintes entre concepts (resp. roles).
Semantique dune inclusion et dune Tbox
Etant donnee une interpretation I de concepts et roles atomiques :
I est un mod`ele dune inclusion B
1
_ C
2
(resp. R
1
_ E
2
) ssi B
I
1
C
I
2
(resp. R
I
1
E
I
2
). Une inclusion satisable a un mod`ele.
I est un mod`ele dune Tbox T ssi cest un mod`ele de chacune des
inclusions de T . Une Tbox satisable a un mod`ele.
Une Tbox est la donnee explicite de contraintes dinclusion. Or de ces
contraintes explicites, on peut deduire de nouvelles contraintes qui sont
implicites `a la Tbox : les contraintes logiquement impliquees par la Tbox.
Contrainte dinclusion impliquee par une Tbox
Une contrainte dinclusion (PI ou NI) est impliquee par une Tbox T ,
notee T [= , ssi tout mod`ele de T est aussi un mod`ele de .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 77 / 103
DL-lite
1
Exemple de Tbox de DL-lite
R
et dinclusions impliquees par une Tbox de DL-lite
R
Tbox (ou ontologie) DL-lite
R
pour le e-commerce
Pcult Pprod Phi Pprod
Phi Pcult
nom Pprod nom
Texte
Pprod nom
ref Pprod ref
Texte
Pprod ref
prix Pprod prix
Texte
Pprod prix
Pconsole Pcult Plect bd dvd Phi
Pbd dvd Pcult Ptv Phi
compatible Pbd dvd compatible
Plect bd dvd
La Tbox T ci-dessus implique par exemple :
les PI : Ptv _ Pprod et compatible _ Pcult
les NI : Pconsole _ Plect bd dvd et compatible _ compatible
Edition)
nom(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,9.98)
compatible(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,http ://www.amazon.fr/Console-Playstation-3-80-
Go)
. . .
Pconsole(http ://www.amazon.fr/Console-Playstation-3-80-Go)
nom(http ://www.amazon.fr/Console-Playstation-3-80-Go,Playstation 3)
prix(http ://www.amazon.fr/Console-Playstation-3-80-Go,450)
. . .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 79 / 103
DL-lite
1
Semantique des Aboxes de DL-lite
R
La semantique dune Abox est denie en termes dinterpretations logiques.
Pour cela, on etend la notion dinterpretation I =
I
, .
I
de concepts et
roles atomiques aux constantes, en assignant `a chaque constante a un
objet distinct dans
I
: a
I
I
.
Attention ! ! !
En DL-lite
R
, on fait lhypoth`ese du nom unique sur les constantes.
Semantique dune assertion et dune Abox de DL-lite
R
Une interpretation I =
I
, .
I
dun ensemble de concepts et roles
atomiques est :
un mod`ele dune assertion A(a) ssi a
I
A
I
;
un mod`ele dune assertion P(a, b) ssi (a
I
, b
I
) P
I
;
un mod`ele dune Abox / ssi I satisfait toutes les assertions de /.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 80 / 103
DL-lite
1
Syntaxe et semantique des bases de connaissances de DL-lite
R
Une base de connaissances / de DL-lite
R
est un couple T , /, o` u T
est une Tbox de DL-lite
R
et / est une Abox de DL-lite
R
.
La semantique dune base de connaissances / = T , / est donnee en
termes dinterpretations.
Semantique dune base de connaissances de DL-lite
R
Une interpretation I est un mod`ele de / ssi I est `a la fois un mod`ele
de T et de /.
Une base de connaissances / est satisable ssi elle a un mod`ele.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 81 / 103
DL-lite
1
Syntaxe et semantique des bases de connaissances de DL-lite
R
Une base de connaissances est la donnee explicite de contraintes
dinclusion (Tbox) et dassertions de faits (Abox). Or de ces connaissances
explicites, on peut deduire de nouvelles connaissances implicites `a la base
de connaissances : les inclusions et assertions logiquement impliquees par
la base de connaissances.
Inclusions et assertions impliquees par une base de connaissances
Une inclusion (PI ou NI) est impliquee par une base de
connaissances / = T , /, notee / [= , ssi T [= .
Une assertion est impliquee par une base de connaissances
/ = T , /, notee / [= , ssi tout mod`ele de / est un mod`ele de .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 82 / 103
DL-lite
1
Syntaxe et semantique des bases de connaissances de DL-lite
R
Assertions impliquees par une base de connaissances de DL-lite
R
T = {Pcult Pprod Phi Pprod
Phi Pcult
nom Pprod nom
Texte
Pprod nom
ref Pprod ref
Texte
Pprod ref
prix Pprod prix
Texte
Pprod prix
Pconsole Pcult Plect bd dvd Phi
Pbd dvd Pcult Ptv Phi
compatible Pbd dvd compatible
Plect bd dvd}
A = { Pbd dvd(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition)
nom(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,9.98)
compatible(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,http ://www.amazon.fr/Console-Playstation-3-80-
Go)
. . .
Pconsole(http ://www.amazon.fr/Console-Playstation-3-80-Go)
nom(http ://www.amazon.fr/Console-Playstation-3-80-Go,Playstation 3)
prix(http ://www.amazon.fr/Console-Playstation-3-80-Go,450)
. . . }
K |= Plect bd dvd(http : //www.amazon.fr /Console Playstation 3 80 Go)
K |= Texte(Playstation3)
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 83 / 103
DL-lite
1
Probl`emes lies `a la gestion de donnees en DL-lite
R
: consistance
En DL-lite
R
, la gestion de donnees seectue relativement `a une base de
connaissances / = T , /. Pour cela, T doit etre satisable. Cest
toujours le cas en DL-lite
R
.
En revanche, une base de connaissances peut etre insatisable, on dit aussi
inconsistante (en gestion de donnees).
Probl`eme de consistance dune base de connaissances
Est-ce que la Abox dune base de connaissances satisfait les contraintes de
la Tbox ?
Cest-`a-dire, formellement, est-ce que la base de connaissances est
satisable.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 84 / 103
DL-lite
1
Probl`emes lies `a la gestion de donnees en DL-lite
R
: consistance
Base de connaissances inconsistante
T = {Pcult Pprod Phi Pprod
Phi Pcult
nom Pprod nom
Texte
Pprod nom
ref Pprod ref
Texte
Pprod ref
prix Pprod prix
Texte
Pprod prix
Pconsole Pcult Plect bd dvd Phi
Pbd dvd Pcult Ptv Phi
compatible Pbd dvd compatible
Plect bd dvd}
A = { Pbd dvd(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition)
nom(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,9.98)
compatible(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,http ://www.amazon.fr/Console-Playstation-3-80-
Go)
. . .
Pconsole(http ://www.amazon.fr/Console-Playstation-3-80-Go)
nom(http ://www.amazon.fr/Console-Playstation-3-80-Go,Playstation 3)
prix(http ://www.amazon.fr/Console-Playstation-3-80-Go,450) . . . }
K |= Pconsole(http : //www.amazon.fr /Console Playstation 3 80 Go)
K |= Plect bd dvd(http : //www.amazon.fr /Console Playstation 3 80 Go)
K |= Plect bd dvd Pconsole K est inconsistante !
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 85 / 103
DL-lite
1
Probl`emes lies `a la gestion de donnees en DL-lite
R
: repondre `a une requete
Rappel sur les requetes et levaluation de requetes.
Requetes du premier ordre
Une requete est une formule ( x) de la logique du premier ordre, o` u x est
lensemble (potentiellement vide) des variables libres de .
Larite dune requete est la cardinalite de x, par ex. lorsque x = , la
requete est booleenne.
Langages de requetes pour la gestion de donnees
Pour des raisons deectivite et decacite (decidabilite/complexite), on
limite la puissance des langages de requetes en recherchant un bon
compromis entre expressivite des requetes et ecacite de leur evaluation.
En base de donnees en general, et dans ce cours en particulier, nous
considerons le langage (dunion) de requetes conjonctives, permettant
dexprimer (lunion,) la selection, la projection et la jointure.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 86 / 103
DL-lite
1
Probl`emes lies `a la gestion de donnees en DL-lite
R
: repondre `a une requete
Union de requetes conjonctives
Une union de requetes conjonctives Q se note Q :
n
i =1
q
i
( x), o` u chaque
requete conjonctive q
i
est une conjonction datomes dont les seules
variables sont celles de x et des variables existentielles.
Ici, les requetes sont posees sur une base de connaissances de DL-lite
R
,
c`ad que les relations utilisees dans les requetes sont des concepts et des
roles atomiques.
Attention ! ! !
Seuls des concepts et roles atomiques sont utilises dans les requetes sur
une base de connaissances de DL-lite
R
.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 87 / 103
DL-lite
1
Probl`emes lies `a la gestion de donnees en DL-lite
R
: repondre `a une requete
Semantique/evaluation dune requete
La reponse `a une requete Q : ( x) darite n 1 posee sur une base de
connaissances / = T , / est ans(Q, /) =
t (
n
[ / [= ( x)
[ x
t]
et (
est lensemble des constantes de /.
Par convention, lorsque la requete est booleenne Q : ( x)
ans(Q, /) = () si / [= (), o` u () est le tuple vide, et
ans(Q, /) = sinon.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 88 / 103
DL-lite
1
Probl`emes lies `a la gestion de donnees en DL-lite
R
: repondre `a une requete
Interrogation semantique de donnees en termes dune base de
connaissances DL-lite
R
Quels sont les noms et references des produits hi `a moins de 500 euros ?
Q : [php]Phi(ph) nom(ph, n) ref (ph, r ) prix(ph, p) p 500
n=Playstation 3 et r=B00005R6XJ
n=Philips - 32PFL5403D/12 et r=B001ANOX7C
. . .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 89 / 103
Algorithmes de gestions de donnees
Test de consistance dune base de connaissances de DL-lite
R
Idee de lalgorithme : pour une base de connaissances de DL-lite
R
, on
va tester si tout couple de relations devant etre disjointes au niveau de la
Tbox ont eectivement des instances disjointes dans la Abox. Pour cela, on
va calculer toutes les NI impliquees de la Tbox et les verier dans la Abox !
Cl oture des NI (= calcul des NI impliquees) dune Tbox de DL-lite
R
Soit T une Tbox de DL-lite
R
. La cloture des NI de T , notee cln(T ), est
denie inductivement comme suit :
1
Toutes les NI de T sont aussi dans cln(T ).
2
Si B
1
B
2
T et B
2
B
3
cln(T ) (ou B
3
B
2
cln(T ))
alors B
1
B
3
cln(T ).
3
Si R
1
R
2
T et R
2
B cln(T ) (ou B R
2
cln(T ))
alors R
1
B cln(T ).
4
Si R
1
R
2
T et R
2
B cln(T ) (ou B R
2
cln(T ))
alors R
1
B cln(T ).
5
Si R
1
R
2
T et R
2
R
3
cln(T ) (ou R
3
R
2
cln(T ))
alors R
1
R
3
cln(T ).
6
Si R R cln(T ) ou R
cln(T ) ou R R cln(T )
alors ces trois NI sont dans cln(T ).
Fran cois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 90 / 103
Algorithmes de gestions de donnees
Test de consistance dune base de connaissances de DL-lite
R
Maintenant que nous avons les NI impliquees par la Tbox une base de
connaissances, il faut verier si celles-ci sont satisfaites par la Abox.
Pour cela, on va verier que la Abox ne fournit pas de contre-exemples `a
(au moins) une NI, en evaluant leurs traductions sur la Abox.
Traduction dune NI
La traduction dune NI est denie par :
(B
1
_ B
2
) = x
1
(x)
2
(x) tel que
i
(x) = A
i
(x) si B
i
= A
i
i
(x) = y
i
P
i
(x, y
i
) if B
i
= P
i
i
(x) = y
i
P
i
(y
i
, x) if B
i
= P
i
(R
1
_ R
2
) = x, y
1
(x, y)
2
(x, y) tel que
i
(x, y) = P
i
(x, y) if R
i
= P
i
i
(x, y) = P
i
(y, x) if R
i
= P
i
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 91 / 103
Algorithmes de gestions de donnees
Test de consistance dune base de connaissances de DL-lite
R
Lalgorithme ci-contre eectue le test
de consistance dun base de connais-
sances / = T , /. Pour cela,
1
il construit une union (booleenne) de
requetes conjonctives q
unsat
initialisee `a
faux (),
2
puis q
unsat
est etendue an de modeliser
la recherche d(au moins) un
contre-exemple `a une NI impliquee de T ,
3
enn si q
unsat
ne produit pas un
contre-exemple `a lune des NI impliquee
lorsquelle est evaluee sur A alors K est
consistante, et inconsistantes sinon.
Propriete de lalgorithme Consistent
Lalgorithme Consistent est correct, c`ad / est consistante ssi
Consistent(/) retourne true.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 92 / 103
Algorithmes de gestions de donnees
Test de consistance dune base de connaissances de DL-lite
R
Base de connaissances inconsistante
T = {Pcult Pprod Phi Pprod
Phi Pcult
nom Pprod nom
Texte
Pprod nom
ref Pprod ref
Texte
Pprod ref
prix Pprod prix
Texte
Pprod prix
Pconsole Pcult Plect bd dvd Phi
Pbd dvd Pcult Ptv Phi
compatible Pbd dvd compatible
Plect bd dvd}
q
unsat
= (Phi Pcult) (Ptv Pcult) (Plect bd dvd Pcult) (compatible
Pcult)
(Pconsole Phi) (Pbd dvd Phi) (compatible Phi) (Pconsole compatible
)
q
unsat
=
x(Phi(x) Pcult(x)) x(Ptv(x) Pcult(x)) x(Plect bd dvd(x) Pcult(x)) x(y compatible(y, x) Pcult(x))
x(Pconsole(x) Phi(x)) x(Pbd dvd(x) Phi(x)) x(y compatible(x, y) Phi(x))
x(Pconsole(x) y compatible(y, x))
Sur lexemple utilise jusqu`a present dans ce cours, on a :
compatible(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,http ://www.amazon.fr/Console-
Playstation-3-80-Go) A
Pconsole(http ://www.amazon.fr/Console-Playstation-3-80-Go) A
Donc x(Pconsole(x) y compatible(y, x)) est vrai dans A, do` u q
db(A)
unsat
= {()}, donc Consistent(K) = false.
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 93 / 103
Algorithmes de gestions de donnees
Reformulation de requetes posees sur une base de connaissances de DL-lite
R
Idee de lalgorithme de reponse `a une requete : le but est de
reformuler une requete posee par un utilisateur sur une base de
connaissances, de fa con `a extraire toutes les informations pertinentes de la
Abox relativement aux PI de la Tbox.
Reformulation de requetes relativement `a une base de connaissances
T = {Pcult Pprod Phi Pprod
Phi Pcult
nom Pprod nom
Texte
Pprod nom
ref Pprod ref
Texte
Pprod ref
prix Pprod prix
Texte
Pprod prix
Pconsole Pcult Plect bd dvd Phi
Pbd dvd Pcult Ptv Phi
compatible Pbd dvd compatible
Plect bd dvd}
Si un utilisateur pose la requete Q : Phi(x) nom(x, y) prix(x, z), la requete devant etre evaluee sur la Abox est
Q
: (Phi(x) nom(x, y) prix(x, z)) (Ptv(x) nom(x, y) prix(x, z)) (Plect bd dvd(x) nom(x, y) prix(x, z))
(t compatible(t, x) nom(x, y) prix(x, z))
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 94 / 103
Algorithmes de gestions de donnees
Reformulation de requetes posees sur une base de connaissances de DL-lite
R
Pour reformuler une requete posee par un utilisateur, on denit la notion de PI applicable `a un
atome dune requete. Une PI I est applicable `a un atome A(x) dune requete si I a A dans sa
partie droite et I est applicable `a un atome P(x
1
, x
2
) si (i ) x
2
= et P est en partie droite de
I ; ou x
1
= et P
A, alors gr (g, I ) = P( , x)
si g = P(x, ) et I = A P, alors gr (g, I ) = A(x)
si g = P(x, ) et I = P
1
P, alors gr (g, I ) = P
1
(x, )
si g = P(x, ) et I = P
1
P, alors gr (g, I ) = P
1
( , x)
si g = P( , x) et I = A P
, alors gr (g, I ) = P
1
(x, )
si g = P( , x) et I = P
1
P
, alors gr (g, I ) = P
1
( , x)
si g = P(x
1
, x
2
) et soit I = P
1
P ou I = P
1
P
alors gr (g, I ) = P
1
(x
1
, x
2
)
si g = P(x
1
, x
2
) et soit I = P
1
P
ou I = P
1
P alors gr (g, I ) = P
1
(x
2
, x
1
)
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 95 / 103
Algorithmes de gestions de donnees
Reformulation de requetes posees sur une base de connaissances de DL-lite
R
Pour reformuler une requete, PerfectRef eectue
jusqu`a trouver un point xe
1
lapplication, de facon iterative, de toutes
les PI aux reformulations en cours de
construction (boucle (a)).
2
La simplication des reformulations
produites (boucle (b)) de sorte que des PI
qui netaient pas applicables `a certaines
reformulations le deviennent.
remplace les variables existentielles sur les-
quelles il ny a pas de jointure par .
reduce remplace deux atomes uniables par leur
plus grand unicateur commun.
Propriete de lalgorithme PerfectRef
Soit q une requete conjonctive posee relativement `a une Tbox T de
DL-lite
R
: q
T
PerfectRef (q, T ).
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 96 / 103
Algorithmes de gestions de donnees
Reformulation de requetes posees sur une base de connaissances de DL-lite
R
Reformulation de requetes relativement `a une base de connaissances
T = {Pcult Pprod Phi Pprod
Phi Pcult
nom Pprod nom
Texte
Pprod nom
ref Pprod ref
Texte
Pprod ref
prix Pprod prix
Texte
Pprod prix
Pconsole Pcult Plect bd dvd Phi
Pbd dvd Pcult Ptv Phi
compatible Pbd dvd compatible
Plect bd dvd}
Si un utilisateur pose la requete Q : Phi(x) nom(x, y) prix(x, z), alors
PerfectRef (Q, T ) = {Phi(x) nom(x, y) prix(x, z),
Ptv(x) nom(x, y) prix(x, z), Plect bd dvd(x) nom(x, y) prix(x, z),
}
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 97 / 103
Algorithmes de gestions de donnees
Reformulation de requetes posees sur une base de connaissances de DL-lite
R
Reformulation de requetes relativement `a une base de connaissances
T = {Pcult Pprod Phi Pprod
Phi Pcult
nom Pprod nom
Texte
Pprod nom
ref Pprod ref
Texte
Pprod ref
prix Pprod prix
Texte
Pprod prix
Pconsole Pcult Plect bd dvd Phi
Pbd dvd Pcult Ptv Phi
compatible Pbd dvd compatible
Plect bd dvd}
Si un utilisateur pose la requete Q : y Plect bd dvd(x) compatible(y, x) Pcult(y), alors PerfectRef (Q, T ) = {
y Plect bd dvd(x) compatible(y, x) Pcult(y),
y compatible( , x) compatible(y, x) Pcult(y), y Plect bd dvd(x) compatible(y, x) Pconsole(y),
y Plect bd dvd(x) compatible(y, x) Pbd dvd(y),
y compatible(y, x) Pcult(y),
y compatible( , x) compatible(y, x) Pconsole(y), y compatible( , x) compatible(y, x) Pbd dvd(y),
y Plect bd dvd(x) compatible(y, x) compatible(y, ), y compatible(y, x) Pconsole(y),
y compatible(y, x) Pbd dvd(y),
Plect bd dvd(x) compatible( , x),
y compatible( , x) compatible(y, x) compatible(y, ), y compatible(y, x) compatible(y, ),
compatible( , x) compatible( , x),
y compatible( , x) compatible(y, x), y compatible(y, x) compatible(y, x), compatible( , x),
}
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 98 / 103
Algorithmes de gestions de donnees
Repondre `a une requete posee sur une base de connaissances de DL-lite
R
Repondre `a une requete posee sur une base de connaissances se fait
maintenant en utilisant Consistent et PerfectRef .
Pour cela, Answer teste avec
Consistent si / est inconsistante
1
si cest le cas, tout les tuples de larite de
Q sont retournes (Alltup(Q, K)),
2
sinon les tuples resultant de levaluation
de lunion des requetes conjonctives
renvoyees par PerfectRef sont retournes.
Propriete de lalgorithme Answer
Soit Q une union de requetes conjonctives posee relativement `a une base
de connaissances / = T , / de DL-lite
R
: ans(Q, /) = Answer (Q, /).
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 99 / 103
Algorithmes de gestions de donnees
Repondre `a une requete posee sur une base de connaissances de DL-lite
R
Requetes sur une base de connaissances inconsistante
T = {Pcult Pprod Phi Pprod
Phi Pcult
nom Pprod nom
Texte
Pprod nom
ref Pprod ref
Texte
Pprod ref
prix Pprod prix
Texte
Pprod prix
Pconsole Pcult Plect bd dvd Phi
Pbd dvd Pcult Ptv Phi
compatible Pbd dvd compatible
Plect bd dvd}
q
unsat
= (Phi Pcult) (Ptv Pcult) (Plect bd dvd Pcult) (compatible
Pcult)
(Pconsole Phi) (Pbd dvd Phi) (compatible Phi) (Pconsole compatible
)
q
unsat
=
x(Phi(x) Pcult(x)) x(Ptv(x) Pcult(x)) x(Plect bd dvd(x) Pcult(x)) x(y compatible(y, x) Pcult(x))
x(Pconsole(x) Phi(x)) x(Pbd dvd(x) Phi(x)) x(y compatible(x, y) Phi(x))
x(Pconsole(x) y compatible(y, x))
Sur lexemple utilise jusqu`a present dans ce cours, on a :
compatible(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,http ://www.amazon.fr/Console-
Playstation-3-80-Go) A
Pconsole(http ://www.amazon.fr/Console-Playstation-3-80-Go) A
Donc x(Pconsole(x) y compatible(y, x)) est vrai dans A, do` u q
db(A)
unsat
= {()}, donc Consistent(K) = false.
Par consequent, pour toute requete Q sur cette base de connaissances, Answer retourne Alltup(Q, K) !
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 100 / 103
Algorithmes de gestions de donnees
Repondre `a une requete posee sur une base de connaissances de DL-lite
R
Indexation (consistante) de pages Web en termes de lontologie
Pbd dvd(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition)
nom(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,9.98)
compatible(http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition,http ://www.amazon.fr/Console-Playstation-3-80-Go)
. . .
Pconsole(http ://www.amazon.fr/Console-Playstation-3-80-Go)
nom(http ://www.amazon.fr/Console-Playstation-3-80-Go,Playstation 3)
prix(http ://www.amazon.fr/Console-Playstation-3-80-Go,450)
. . .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 101 / 103
Algorithmes de gestions de donnees
Repondre `a une requete posee sur une base de connaissances de DL-lite
R
Interrogation semantique de donnees en termes de lontologie
Quels sont les DVD/Blu-ray `a moins de 20 euros compatibles avec la
PS3 ? Q(d) : bd dvd(d) prix(d, p) p 20 compatible(d, l ) nom(l , Playstation 3)
d=http ://www.amazon.fr/Fabuleux-destin-dAmelie-Poulain-
Edition
d=http ://www.amazon.fr/Harry-potter-lecole-sorciers-Blu-ray
. . .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 102 / 103
Algorithmes de gestions de donnees
Repondre `a une requete posee sur une base de connaissances de DL-lite
R
Interrogation semantique de donnees en termes de lontologie
Quels sont les noms et references des produits hi `a moins de 500 euros ?
Q(n, r ) : Phi(ph) nom(ph, n) ref (ph, r ) prix(ph, p) p 500
n=Playstation 3 et r=B00005R6XJ
n=Philips - 32PFL5403D/12 et r=B001ANOX7C
. . .
Francois Goasdoue (Univ. Paris-Sud) Web Semantique 24 avril 2013 103 / 103