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

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" .
}