This commit is contained in:
OMGiTzPomPom 2023-02-02 11:51:05 +01:00
parent ed8f1fb109
commit 5f45e953d5
14 changed files with 554 additions and 0 deletions

0
TD0/seance2/titanic.rdf Normal file
View File

28
TD0/seance2/titanic.ttl Normal file
View File

@ -0,0 +1,28 @@
@prefix ex: <http://www.example.org/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ex:Film rdf:type rdfs:class .
ex:Person rdf:type rdfs:class .
ex:Actor rdf:type rdfs:class .
ex:PrincipalActior rdf:type rdfs:class .
ex:Director rdf:type rdfs:class .
ex:CreaticeWork rdf:type rdfs:class .
ex:Actor rdfs:subClassOf ex:Person .
ex:PrincipalActor rdfs:subClassOf ex:Actor .
ex:hasRoleIn rdf:type rdf:Property .
ex:hasRoleIn rdfs:domain ex:Actor .
ex:hasRoleIn rdfs:domain ex:Director .
ex:hasRoleIn rdfs:range ex:Film .
ex:hasPrincipalRoleIn rdfs:subPropertyOf ex:hasRoleIn .
ex:starring a rdf:Property ;
rdfs:domain ex:Director;
rdfs:rand ex:Film .
ex:Titanic rdf:type ex:Film .
ex:Leonardo_DiCaprio rdf:type ex:Actor .
ex:Kate_Winslet rdf:type ex:Actor .

22
TD1/exercice1.rdf Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://www.exercise1.edu/">
<rdf:Description rdf:about="ex:Paris"></rdf:Description>
<rdf:Description rdf:about="ex:Cosette"></rdf:Description>
<rdf:Description rdf:about="ex:Tour_Eiffel">
<ex:Location rdf:resource="ex:Paris"></ex:Location>
</rdf:Description>
<rdf:Description rdf:about="ex:Les_Miserables">
<ex:HasTome rdf:resource="ex:Cosette"></ex:HasTome>
</rdf:Description>
<rdf:Description rdf:about="ex:Victor_Hugo">
<ex:POB rdf:resource="ex:Paris"></ex:POB>
<ex:DOB>02/26/1802</ex:DOB>
<ex:hasWrite rdf:resource="ex:Les_Miserables"></ex:hasWrite>
</rdf:Description>
</rdf:RDF>

8
TD1/exercice2.ttl Normal file
View File

@ -0,0 +1,8 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ex: <http://www.exercise2.edu/> .
ex:Jean a foaf:person .
ex:Marie a foaf:person .
ex:Jean ex:Aime ex:Marie .

32
TD1/exercise3.rdf Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://www.exercise3.edu/"
xmlns:dc= "http://purl.org/dc/elements/1.1/"
>
<rdf:Description rdf:about="http://www.exemple.com/rdf.html">
<dc:creator rdf:nodeID="80145"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.MohWebSite.com">
<ex:LastUpdate> 09-01-2023 </ex:LastUpdate>
</rdf:Description>
<rdf:Description rdf:nodeID="80145">
<ex:name> Benjamin </ex:name>
<ex:e-mail> Ben@yahoo.fr </ex:e-mail>
<ex:webSite rdf:resource="http://www.BenWebSite.com"></ex:webSite>
</rdf:Description>
<rdf:Description rdf:about="http://example.com/courses/Semantic_web">
<ex:students>
<rdf:Bag>
<rdf:li rdf:resource="http://example.com/students/Oscar"/>
<rdf:li rdf:nodeID="80145"/>
<rdf:li rdf:resource="http://example.com/students/Alice"/>
<rdf:li rdf:resource="http://example.com/students/Marie"/>
</rdf:Bag>
</ex:students>
</rdf:Description>
</rdf:RDF>

41
TD1/exercise4.rdf Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://www.exercise4.edu/"
>
<rdf:Description rdf:about="France"></rdf:Description>
<rdf:Description rdf:about="Italy"></rdf:Description>
<rdf:Description rdf:about="ex:Antibes"></rdf:Description>
<rdf:Description rdf:about="ex:Sauve_Moi">
<ex:publication_date>2005</ex:publication_date>
</rdf:Description>
<rdf:Description rdf:about="chevalier_de_l_ordre_des_Art_et_des_lettres_award">
<ex:dateOfDelivery>2012</ex:dateOfDelivery>
<ex:placeOfDelivery rdf:ressource="ex:France"></ex:placeOfDelivery>
</rdf:Description>
<rdf:Description rdf:about="Raymond_Chandler_award">
<ex:dateOfDelivery>2021</ex:dateOfDelivery>
<ex:placeOfDelivery rdf:ressource="ex:Italy"></ex:placeOfDelivery>
</rdf:Description>
<rdf:Description rdf:about="ex:Guillaume_Muso">
<ex:hasAge>48</ex:hasAge>
<ex:POB rdf:ressource="ex:Antibes"></ex:POB>
<ex:hasWritten rdf:ressource="ex:Sauve_Moi"></ex:hasWritten>
<ex:awards>
<rdf:Bag>
<rdf:li rdf:resource="chevalier_de_l_ordre_des_Art_et_des_lettres_award" />
<rdf:li rdf:resource="Raymond_Chandler_award" />
</rdf:Bag>
</ex:awards>
</rdf:Description>
</rdf:RDF>

View File

@ -0,0 +1,208 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf [
<!ENTITY humans "http://www.inria.fr/2007/09/11/humans.rdfs">
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema">
]>
<rdf:RDF
xmlns:rdf ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="&rdfs;#"
xmlns ="&rdfs;#"
xml:base ="&humans;" >
<Class rdf:ID="Animal">
<label xml:lang="en">animal</label>
<comment xml:lang="en">a living organism characterized by voluntary movement.</comment>
<label xml:lang="fr">animal</label>
<comment xml:lang="fr">être vivant doué de sensibilite de mobilité.</comment>
</Class>
<Class rdf:ID="Male">
<subClassOf rdf:resource="#Animal"/>
<label xml:lang="en">male</label>
<comment xml:lang="en">an animal that produces gametes (spermatozoa) that can fertilize female gametes (ova).</comment>
<label xml:lang="fr">mâle</label>
<comment xml:lang="fr">individu appartenant au sexe qui possède le pouvoir de fécondation.</comment>
</Class>
<Class rdf:ID="Female">
<subClassOf rdf:resource="#Animal"/>
<label xml:lang="en">female</label>
<comment xml:lang="en"> an animal that produces gametes (ova) that can be fertilized by male gametes (spermatozoa).</comment>
<label xml:lang="fr">femelle</label>
<comment xml:lang="fr">animal appartenant au sexe apte à produire des ovules.</comment>
</Class>
<Class rdf:ID="Man">
<subClassOf rdf:resource="#Person"/>
<subClassOf rdf:resource="#Male"/>
<label xml:lang="en">man</label>
<comment xml:lang="en">an adult male person</comment>
<label xml:lang="fr">homme</label>
<comment xml:lang="fr">mâle adulte de l'espèce humaine.</comment>
</Class>
<Class rdf:ID="Person">
<subClassOf rdf:resource="#Animal"/>
<label xml:lang="en">person</label>
<label xml:lang="en">human being</label>
<label xml:lang="en">human</label>
<comment xml:lang="en">a member of the human species</comment>
<label xml:lang="fr">personne</label>
<label xml:lang="fr">être humain</label>
<label xml:lang="fr">humain</label>
<label xml:lang="fr">homme</label>
<comment xml:lang="fr">un membre de l'espèce humaine.</comment>
</Class>
<Class rdf:ID="Lecturer">
<subClassOf rdf:resource="#Person"/>
<label xml:lang="en">lecturer</label>
<comment xml:lang="en">someone who lectures professionally</comment>
<label xml:lang="fr">professeur</label>
<comment xml:lang="fr">personne qui enseigne une discipline, une technique, un art.</comment>
</Class>
<Class rdf:ID="Researcher">
<subClassOf rdf:resource="#Person"/>
<label xml:lang="en">researcher</label>
<label xml:lang="en">scientist</label>
<comment xml:lang="en">a person who devotes himself to doing research</comment>
<label xml:lang="fr">chercheur</label>
<label xml:lang="fr">scientifique</label>
<comment xml:lang="fr">personne adonnée à des recherches spécialisées.</comment>
</Class>
<Class rdf:ID="Woman">
<subClassOf rdf:resource="#Person"/>
<subClassOf rdf:resource="#Female"/>
<label xml:lang="en">woman</label>
<comment xml:lang="en">an adult female person</comment>
<label xml:lang="fr">femme</label>
<comment xml:lang="fr">femelle adulte de l'espèce humaine.</comment>
</Class>
<rdf:Property rdf:ID="hasAncestor">
<domain rdf:resource="#Animal"/>
<range rdf:resource="#Animal"/>
<label xml:lang="en">has for ancestor</label>
<comment xml:lang="en">relation between an animal and another animal from which it is descended.</comment>
<label xml:lang="fr">a pour ancêtre</label>
<comment xml:lang="fr">relation entre un animal et un autre animal duquel il descend.</comment>
</rdf:Property>
<rdf:Property rdf:ID="hasParent">
<subPropertyOf rdf:resource="#hasAncestor"/>
<label xml:lang="en">has for parent</label>
<comment xml:lang="en">relation between an animal and another animal which gave birth to it.</comment>
<label xml:lang="fr">a pour parent</label>
<comment xml:lang="fr">relation entre un animal et un autre animal qui lui a donné naissance.</comment>
</rdf:Property>
<rdf:Property rdf:ID="hasChild">
<label xml:lang="en">has for child</label>
<comment xml:lang="en">relation between an animal and another animal to which it gave birth.</comment>
<label xml:lang="fr">a pour enfant</label>
<comment xml:lang="fr">relation entre un animal et un autre animal auquel il a donné naissance.</comment>
</rdf:Property>
<rdf:Property rdf:ID="hasFather">
<subPropertyOf rdf:resource="#hasParent"/>
<range rdf:resource="#Male"/>
<label xml:lang="en">has for father</label>
<comment xml:lang="en">to have for parent a male.</comment>
<label xml:lang="fr">a pour père</label>
<comment xml:lang="fr">avoir pour parent un mâle.</comment>
</rdf:Property>
<rdf:Property rdf:ID="hasMother">
<subPropertyOf rdf:resource="#hasParent"/>
<range rdf:resource="#Female"/>
<label xml:lang="en">has for mother</label>
<comment xml:lang="en">to have for parent a female.</comment>
<label xml:lang="fr">a pour mère</label>
<comment xml:lang="fr">avoir pour parent un femmelle.</comment>
</rdf:Property>
<rdf:Property rdf:ID="hasBrother">
<domain rdf:resource="#Animal"/>
<range rdf:resource="#Male"/>
<label xml:lang="en">has for brother</label>
<comment xml:lang="en">relation with a male who has the same parents.</comment>
<label xml:lang="fr">a pour frère</label>
<comment xml:lang="fr">relation avec un mâle ayant les mêmes parents.</comment>
</rdf:Property>
<rdf:Property rdf:ID="hasSister">
<domain rdf:resource="#Animal"/>
<range rdf:resource="#Female"/>
<label xml:lang="en">has for sister</label>
<comment xml:lang="en">relation with a female who has the same parents.</comment>
<label xml:lang="fr">a pour soeur</label>
<comment xml:lang="fr">relation avec une femelle ayant les mêmes parents.</comment>
</rdf:Property>
<rdf:Property rdf:ID="hasFriend">
<domain rdf:resource="#Person"/>
<range rdf:resource="#Person"/>
<label xml:lang="en">has for friend</label>
<comment xml:lang="en">relation between a person and another person he or she knows well and regards with affection and trust.</comment>
<label xml:lang="fr">a pour ami</label>
<comment xml:lang="fr">relation entre une personne et une autre personne qui est l'objet d'un attachement privilégié.</comment>
</rdf:Property>
<rdf:Property rdf:ID="name">
<label xml:lang="en">name</label>
<label xml:lang="fr">nom</label>
<comment xml:lang="en">designation of something.</comment>
<comment xml:lang="fr">désignation de quelque chose.</comment>
</rdf:Property>
<rdf:Property rdf:ID="shoesize">
<domain rdf:resource="#Person"/>
<label xml:lang="en">shoe size</label>
<label xml:lang="en">size</label>
<label xml:lang="fr">pointure</label>
<comment xml:lang="en">express in some way the approximate length of the shoes for a person.</comment>
<comment xml:lang="fr">taille, exprimée en points, des chaussures d'une personne.</comment>
</rdf:Property>
<rdf:Property rdf:ID="age">
<label xml:lang="en">age</label>
<label xml:lang="fr">âge</label>
<comment xml:lang="en">complete existence duration.</comment>
<comment xml:lang="fr">durée complète d'existence.</comment>
</rdf:Property>
<rdf:Property rdf:ID="shirtsize">
<domain rdf:resource="#Person"/>
<label xml:lang="en">shirt size</label>
<label xml:lang="en">size</label>
<label xml:lang="fr">taille de chemise</label>
<label xml:lang="fr">taille</label>
<comment xml:lang="en">express in some way the approximate dimensions of the shirts of a person.</comment>
<comment xml:lang="fr">dimensions approximatives des chemises portées par une personne.</comment>
</rdf:Property>
<rdf:Property rdf:ID="trouserssize">
<domain rdf:resource="#Person"/>
<label xml:lang="en">trousers size</label>
<label xml:lang="en">size</label>
<label xml:lang="fr">taille de pantalon</label>
<label xml:lang="fr">taille</label>
<comment xml:lang="en">express in some way the approximate dimensions of the trousers of a person.</comment>
<comment xml:lang="fr">dimensions approximatives des pantalons portés par une personne.</comment>
</rdf:Property>
<rdf:Property rdf:ID="hasSpouse">
<domain rdf:resource="#Person"/>
<range rdf:resource="#Person"/>
<label xml:lang="en">has for spouse</label>
<label xml:lang="fr">est en ménage avec</label>
<comment xml:lang="en">a person's partner in marriage.</comment>
<comment xml:lang="fr">le partenaire d'une personne dans un mariage.</comment>
</rdf:Property>
</rdf:RDF>

6
TD2/td.MD Normal file
View File

@ -0,0 +1,6 @@
# TD2
# Exercice 1
1. http://www.inria.fr/2007/09/11/humans.rdfs
2.

13
TD3/cours.sparqlbook Normal file
View File

@ -0,0 +1,13 @@
prefix ex:<www.example.org>
premix rdf <...>
SELECT ?creation_date
WHERE
?ex:Film:ex:name Titanic
SELECT ?film_name
WHERE {
?ex:creation_date ?creation_date .
ex:name : ?film_name
FILTER (?creation_date > "1998-01-01"^^xsd:dateTime)
}

51
TD4/books.ttl Normal file
View File

@ -0,0 +1,51 @@
@prefix books: <http://www.semanticWeb.org/sprql-td/> .
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix dcterms: <http://purl.org/dc/terms/>.
books:Book1 a booksschema:Book;
booksschema:hasGenre booksschema:Romance_novel, booksschema:Fiction ;
dcterms:title "Sauve-Moi"@fr;
dcterms:creator books:Musso;
dcterms:date "2013";
booksschema:hasPrice 8.
books:Book5 a booksschema:Book;
booksschema:hasGenre booksschema:Romance_novel, booksschema:Fiction ;
dcterms:title "Central Park"@fr;
dcterms:creator books:Musso;
dcterms:date "2014";
booksschema:hasPrice 9.
books:Book2 a booksschema:Book;
booksschema:hasGenre booksschema:Romance_novel, booksschema:Young_adult_fiction ;
dcterms:title "Nos etoile contraire"@fr, "The Fault in Our Stars"@en;
dcterms:creator books:Green;
dcterms:date "2012";
booksschema:hasPrice 10.
books:Book3 a booksschema:Book;
booksschema:hasGenre booksschema:Romance_novel;
dcterms:title "Tout le bleu du ciel"@fr;
dcterms:creator books:DaCosta;
dcterms:date "2019".
books:Book4 a booksschema:Book;
booksschema:hasGenre booksschema:Youth_comics;
dcterms:title "5 Monde?"@fr;
dcterms:date "2017";
booksschema:hasPrice 20.
books:Musso rdf:type foaf:Person;
foaf:name "Guillaume Musso";
foaf:age "48" .
books:Green rdf:type foaf:Person;
foaf:name "John Green";
foaf:age "47" .
books:DaCosta rdf:type foaf:Person;
foaf:name "Melissa Da Costa";
foaf:age "32" .

BIN
TD4/corese-gui-4.3.3.jar Normal file

Binary file not shown.

145
TD4/rep.sql Normal file
View File

@ -0,0 +1,145 @@
--1
select * where {
?name ?type ?value
}
--2
select ?name ?value where {
?name rdf:type ?value
}
--3
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
select ?name ?value where {
?name rdf:type booksschema:Book .
?name booksschema:hasGenre ?value .
}
--4
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
@prefix dcterms: <http://purl.org/dc/terms/>.
select ?name ?gender ?value where {
?name rdf:type booksschema:Book .
?name booksschema:hasGenre ?gender .
OPTIONAL {?name dcterms:title ?value}
}
--5
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
@prefix dcterms: <http://purl.org/dc/terms/>.
select ?name ?value where {
?name rdf:type booksschema:Book .
OPTIONAL {?name dcterms:title ?value}
FILTER(lang(?value)='fr')
}
--6
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
select * where {
?name rdf:type booksschema:Book .
OPTIONAL { ?name booksschema:hasPrice ?price }
FILTER(?price > 8) .
}
--7
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
select (count(?name) as ?PriceBooks) where {
?name rdf:type booksschema:Book
}
--8
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
select (count(?book) as ?nbBook) ?genre where {
?book booksschema:hasGenre ?genre
}
group by ?genre
having (?nbBook >= 2)
--9
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
select ?title ?author where {
?b dcterms:title ?title
?b dcterms:creator ?author
filter(contains(LCase(?title), "contraire"))
}
--10
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
select ?title ?author {
?b dcterms:creator ?author .
?b dcterms:title ?title .
{
?author foaf:name "Guillaume Musso".
}
UNION
{
?author foaf:name "Melissa Da Costa".
}
}
--11
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
select (avg(?price) as ?AvgPrice) where {
?book booksschema:hasPrice ?price
}
--12
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix books: <http://www.semanticWeb.org/sprql-td/> .
INSERT {
?book dcterms:creator books:siegel
}
WHERE {
?book dcterms:title ?title .
FILTER(contains (?title, "5 Monde?"))
}
--13
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
@prefix books: <http://www.semanticWeb.org/sprql-td/> .
INSERT {
?book booksschema:hasPrice "15" .
} WHERE {
?book dcterms:creator ?author .
?author foaf:name "Melissa Da Costa" .
}
--14
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix booksschema: <http://www.example.org/sprql-td/vocabs/> .
@prefix books: <http://www.semanticWeb.org/sprql-td/> .
DELETE {
?book booksschema:hasPrice "15" .
}
INSERT {
?book booksschema:hasPrice "8" .
} WHERE {
?book dcterms:creator ?author .
?author foaf:name "Melissa Da Costa" .
}