Notions sur la sérialisation RDFS/XML

RDFS permet de définir un schéma (sémantique) d'une application spécifique. RDF Schema est défini par l'URI :

http://www.w3.org/2000/01/rdf-schema#, et le préfixe est rdfs.

Pour le vocabulaire introduit dans ce cours, on utilise la notation des triplets RDF pour définir plusieurs classes de documents comme suit :

cs:Publication

cs:Book

cs:JournalPaper

cs:ConfPaper

cs:ShortPaper

cs:Book

cs:JournalPaper

cs:ConfPaper

cs:ShortPaper

cs:ShortPaper

rdf:type

rdf:type

rdf:type

rdf:type

rdf:type

rdfs:subClassOf

rdfs:subClassOf

rdfs:subClassOf

rdfs:subClassOf

rdfs:subClassOf

rdfs:Class

rdfs:Class

rdfs:Class

rdfs:Class

rdfs:Class

cs:Publication

cs:Publication

cs:Publication

cs:JournalPaper

cs :ConfPaper

1
<?xml version="1.0"?>
2
<rdf:RDF	xml:base="http://www.cat.com/schema/"
3
 			xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4
 			xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
5
 			xmlns:dc="http://purl.org/dc/elements/1.1/">
6
 <rdf:Description rdf:about="Publication">
7
 	   <rdf:type 	rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
8
 </rdf:Description>
9
 <rdf:Description rdf:about="Book">
10
 	  <rdf:type	  rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
11
	  <rdfs:subClassOf rdf:resource="Publication"/>
12
 </rdf:Description>
13
 <rdf:Description rdf:about="JournalPaper">
14
 	    <rdf:type   rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
15
 	    <rdfs:subClassOf rdf:resource="Publication"/>
16
 </rdf:Description>
17
 <rdf:Description rdf:about="ConfPaper">
18
 	    <rdf:type  rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
19
 	    <rdfs:subClassOf rdf:resource="Publication"/>
20
 </rdf:Description>
21
 <rdf:Description rdf:about="ShortPaper">
22
 	    <rdf:type   rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
23
 	    <rdfs:subClassOf rdf:resource="JournalPaper"/>
24
 	    <rdfs:subClassOf rdf:resource="ConfPaper"/>
25
 </rdf:Description>
26
 </rdf:RDF>

Syntaxe abrégée

1
<?xml version="1.0"?>
2
<rdf:RDF	xml:base="http://www.cat.com/schema/"
3
 			xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4
 			xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
5
 			xmlns:dc="http://purl.org/dc/elements/1.1/">
6
 
7
	<rdfs:Class	 rdf:about="Publication"/>
8
 	
9
   <rdfs:Class   rdf:about="Book">
10
 		  <rdfs:subClassOf rdf:resource="Publication"/>
11
 	</rdfs:Class>
12
 
13
	<rdfs:Class rdf:about="JournalPaper">
14
 	 	<rdfs:subClassOf rdf:resource="Publication"/>
15
 	</rdfs:Class>
16
17
 	<rdfs:Class rdf:about="ConfPaper">
18
 	 	<rdfs:subClassOf rdf:resource="Publication"/>
19
 	</rdfs:Class>
20
21
	<rdfs:Class rdf:about="ShortPaper">
22
 	 	  <rdfs:subClassOf rdf:resource="JournalPaper"/>
23
 		  <rdfs:subClassOf rdf:resource="ConfPaper"/>
24
	 </rdfs:Class>
25
26
 </rdf:RDF>

Propriétés dans RDFS

Le prédicat (propriété) est une instance de la classe Property .

Exemple :

1
<?xml version="1.0"?>
2
<!DOCTYPE rdf:RDF  [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]>
3
4
<rdf:RDF		xml:base="http://www.cat.com/schema/"
5
 			xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
 			xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
7
 			xmlns:dc="http://purl.org/dc/elements/1.1/">
8
 	
9
	<rdfs:Class    rdf:about="Publication"/>
10
 	<rdfs:Class   rdf:about="Book">
11
 		  <rdfs:subClassOf rdf:resource="Publication"/>
12
 	</rdfs:Class>
13
 	<rdfs:Class rdf:about="JournalPaper">
14
 	 	<rdfs:subClassOf rdf:resource="Publication"/>
15
 	</rdfs:Class>
16
 	<rdfs:Class rdf:about="ConfPaper">
17
 	 	<rdfs:subClassOf rdf:resource="Publication"/>
18
 	</rdfs:Class>
19
	<rdfs:Class rdf:about="ShortPaper">
20
 	 	<rdfs:subClassOf rdf:resource="JournalPaper"/>
21
 		<rdfs:subClassOf rdf:resource="ConfPaper"/>
22
	 </rdfs:Class>
23
<rdf:Property rdf:about="noPages">
24
 		<rdfs:domain rdf:resource="Publication"/>
25
		<rdfs:range rdf:resource="&xsd;positiveInteger"/>
26
 	</rdf:Property>
27
28
	<rdf:Property rdf:about="placeOfPublication">
29
		 <rdfs:domain rdf:resource="ConfPaper"/>
30
 		<rdfs:range rdf:resource="&xsd;string"/>
31
 	</rdf:Property>
32
33
</rdf:RDF>

Instanciation d'un schéma RDF

Dans l'exemple de sérialisation, le catalogue des métadonnées des documents est basé sur 3 vocabulaires (espaces de noms)

  • http://www.cat.com/schema/ ==> schéma du catalogue (ensemble de classes et de propriétés)

  • http://www.cat.com/docs ==> ensemble des instances des classes et des propriétés définies dans le schéma du catalogue

  • http://www.cat.com/auth ==> liste des auteurs, publishers, ...

1
<?xml version= "1.0"?>
2
 <!DOCTYPE rdf:RDF   [<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">]>
3
 
4
<rdf:RDF  	xml:base="http://www.cat.com/docs"
5
 			xmlns:cs="http://www.cat.com/schema/"
6
 			xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7
 			xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
8
 			xmlns:dc="http://purl.org/dc/elements/1.1/">
9
 
10
	<cs:Book 	 rdf:about="#R20301">
11
 		<dc:creator  rdf:resource="http://www.cat.com/auth#R051156"/>
12
 		<dc:title>  SEMANTIC WEB: CONCEPTS AND TECHNOLOGIES
13
 				   FOR THE GEOGRAPHIC INFORMATION SCIENCES  </dc:title>
14
 		<dc:date rdf:datatype="&xsd;date">  2021-01-20  </dc:date>
15
 		<cs:noPages>  324  </cs:noPages>
16
 	</cs:Book>
17
18
<cs:ConfPaper   rdf:about="#R20302">
19
 <dc:creator   rdf:resource="http://www.cat.com/auth#R051156"/>
20
 <dc:title>  USING GAZETTEERS TO ANNOTATE GEOGRAPHIC
21
 			CATALOGUE ENTRIES
22
 </dc:title>
23
 <dc:date rdf:datatype="&xsd;date">  2021-01-21  </dc:date>
24
 <cs:noPages>  6  </cs:noPages>
25
 <cs:placeOfPublication>  Chipre  </cs:placeOfPublication>
26
 </cs:ConfPaper>
27
28
 </rdf:RDF>