Upload
aousten-dumoulin
View
107
Download
0
Embed Size (px)
Citation preview
LANGAGES DU WEB SÉMANTIQUE
RDF
Resource Description Framework
http://www.w3.org/RDF/
LANGAGES DU WEB SÉMANTIQUE
RDF est un langage permettant de représenter des informations sur des ressources. Tout est ressource
Description de triplets sujet-prédicat-objet constituants un graphe étiqueté orienté
Utilise les URIs
http://www.ex.com/annuaire#tbl
http://www.ex.com/org#W3C Tim Berners-Lee
http://www.ex.com/voc#dirige http://www.ex.com/voc#nom
RDF - Presentation
LANGAGES DU WEB SÉMANTIQUE
RDF - Presentation
Un triplet ou une déclaration est formée de:• Un sujet: URI• Un prédicat: URI• Un objet: URI ou littéral
http://www.ex.com/annuaire#tbl Tim Berners-Lee
http://www.ex.com/voc#nom
prédicatsujet objet
LANGAGES DU WEB SÉMANTIQUE
RDF - Syntaxe
RDF/XML basé sur XMLRecommandation W3C: http://www.w3.org/TR/rdf-syntax-grammar/
• élément rdf:RDF contenant les déclarations d’espaces de noms.• élément rdf:Description contient l’URI du sujet dans l’attribut rdf:about. • un élément RDF peut contenir plusieurs Descriptions• plusieurs prédicats-Objets dans une Description
< ?xml version="1.0" ?><rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:exvoc="http://www.ex.com/voc#">
<rdf:Description rdf:about="http://www.ex.com/annuaire#tbl"> <exvoc:nom>Tim Berners-Lee</exvoc:nom> <exvoc:dirige rdf:resource="http://www.ex.com/org#W3C"/> </rdf:Description>
</rdf:RDF>
LANGAGES DU WEB SÉMANTIQUE
RDF - Syntaxe
La syntaxe RDF/XML est bien adaptée à la lecture par lesmachines. . .
. . . mais pas très lisible.
Une autre syntaxe plus facile à interpréter par l’homme a été définie:
Notation 3 « N3 »
LANGAGES DU WEB SÉMANTIQUE
RDF - Syntaxe
Notation 3http://www.w3.org/DesignIssues/Notation3
Simplification d’écriture: • Préfixes• Même sujet, même prédicat : {sujet predicate objet1, objet2, objet3.}• Même sujet : {sujet predicate1 objet1 ; predicat2 objet2.}
@prefix exvoc: http://www.ex.com/voc#
<http://www.ex.com/annuaire#tbl> exvoc:nom "Tim Berners-Lee" .<http://www.ex.com/annuaire#tbl> exvoc:dirige <www.ex.com/org#W3C> .
LANGAGES DU WEB SÉMANTIQUE
RDF - Grammaire
Blank nodeDans certains cas, on veut représenter des données sur un sujet, sans en faire
une URI. Nœud « local » à un graphe, agrégation de donnéesUtilisation de nodeId pour RDF/XML et de « _ » pour N3
…<rdf:Description rdf:nodeID="n1"> <exterms:street>1501 Grant Avenue</exterms:street></rdf:Description>…
…_:johnaddress exterms:street "1501 Grant Avenue" .…
RDF/XML N3
LANGAGES DU WEB SÉMANTIQUE
RDF - Grammaire
…<http://www.ex.com/annuaire#tbl> exvoc:dateNaissance "1955-06-08" .…
Data type - Littéraux typésRDF est un langage pour véhiculer du sens interprétable par un ordinateur, il
n’est pas là pour générer des ambiguïtés:
• Est-ce une chaine de caractères ?• Un réel ?• Un entier ?• Une date ? AAAA-MM-JJ ou AAAA-JJ-MM ou JJ-MM-AAA ?
On type les littéraux, i.e. représenter explicitement leur type.
LANGAGES DU WEB SÉMANTIQUE
RDF - Grammaire
Data type - Littéraux typésRDF ne contient pas de types mais permet d’associer un type à un littéral.xsd:date est toujours au format AAAA-MM-JJ
…<exvoc:dateNaissance rdf:datatype=http://www.w3.org/2001/XMLSchema#date>1955-06-08</exvoc:dateNaissance>…
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>…<http://www.ex.com/annuaire#tbl> exvoc:dateNaissance "1955-06-08"^^xsd:date . …
RDF/XML (pas de préfixe possible)
N3
…<!DOCTYPE rdf:RDF[<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]> <exvoc:dateNaissance rdf:datatype="&xsd;date">1955-06-08</exvoc:dateNaissance>…
RDF/XML (avec utilisation de DTD)
LANGAGES DU WEB SÉMANTIQUE
RDF - Grammaire
Data type – Types XML-SchemaTypes primitifs, dérivés, complexes (union, liste, restriction)Dérivation possible de ses propres types
<xsd:schema ...> <xsd:simpleType name="humanAge"> <xsd:restriction base="integer"> <xsd:minInclusive value="0"> <xsd:maxExclusive value="150"> </xsd:restriction> </xsd:simpleType>...</xsd:schema>
http://www.w3.org/TR/xmlschema-2/
Exemple de dérivation par restriction:
LANGAGES DU WEB SÉMANTIQUE
RDF - Grammaire
Typage des ressourcesOn désire caractériser une ressource comme étant de type …RDF fournit un prédicat rdf:type à cet effet.
<rdf:Description rdf:about="http://www.ex.com/annuaire#tbl"> <rdf:type rdf:resource="http://www.ex.com/types#membre"/> <exvoc:nom>Tim Berners-Lee</exvoc:nom></rdf:Description>
LANGAGES DU WEB SÉMANTIQUE
RDF - Grammaire
Conteneursrdf:type de la ressource : Bag, Seq ou AltLes membres sont décris à l’aide du prédicat rdf:_i (avec i, entier supérieur à 0)
• Bag: doublons possibles, non ordonnés• Seq: doublons possibles, ordonnés• Alt: pas de doublons, non ordonnés
LANGAGES DU WEB SÉMANTIQUE
RDF - Grammaire
RéificationSert à exprimer une information sur un tripletConsidère un triplet comme une ressource
Tony dit que Boby a tué Cindy
http://www.ex.com/annuaire#Boby
http://www.ex.com/voc#aTuehttp://
www.ex.com/annuaire#Cindy
http://www.ex.com/annuaire#Tony
LANGAGES DU WEB SÉMANTIQUE
RDF - Grammaire
RéificationUn triplet et sa réification ne sont pas équivalentsIl est impossible de les lier
exannu:Boby exvoc:aTue exannu:Cindy.
extriple:triplet40 rdf:type rdf:Statement ;rdf:subject exannu:Boby ;rdf:predicate exvoc:aTue ;rdf:object exannu:Cindy.