--1
select * where {
?name ?type ?value
}
--2
select ?name ?value where {
?name rdf:type ?value
}
--3
@prefix booksschema: .
select ?name ?value where {
?name rdf:type booksschema:Book .
?name booksschema:hasGenre ?value .
}
--4
@prefix booksschema: .
@prefix dcterms: .
select ?name ?gender ?value where {
?name rdf:type booksschema:Book .
?name booksschema:hasGenre ?gender .
OPTIONAL {?name dcterms:title ?value}
}
--5
@prefix booksschema: .
@prefix dcterms: .
select ?name ?value where {
?name rdf:type booksschema:Book .
OPTIONAL {?name dcterms:title ?value}
FILTER(lang(?value)='fr')
}
--6
@prefix dcterms: .
@prefix booksschema: .
select * where {
?name rdf:type booksschema:Book .
OPTIONAL { ?name booksschema:hasPrice ?price }
FILTER(?price > 8) .
}
--7
@prefix booksschema: .
@prefix dcterms: .
select (count(?name) as ?PriceBooks) where {
?name rdf:type booksschema:Book
}
--8
@prefix booksschema: .
@prefix dcterms: .
select (count(?book) as ?nbBook) ?genre where {
?book booksschema:hasGenre ?genre
}
group by ?genre
having (?nbBook >= 2)
--9
@prefix booksschema: .
@prefix dcterms: .
select ?title ?author where {
?b dcterms:title ?title
?b dcterms:creator ?author
filter(contains(LCase(?title), "contraire"))
}
--10
@prefix booksschema: .
@prefix dcterms: .
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: .
@prefix dcterms: .
select (avg(?price) as ?AvgPrice) where {
?book booksschema:hasPrice ?price
}
--12
@prefix dcterms: .
@prefix books: .
INSERT {
?book dcterms:creator books:siegel
}
WHERE {
?book dcterms:title ?title .
FILTER(contains (?title, "5 Monde?"))
}
--13
@prefix dcterms: .
@prefix booksschema: .
@prefix books: .
INSERT {
?book booksschema:hasPrice "15" .
} WHERE {
?book dcterms:creator ?author .
?author foaf:name "Melissa Da Costa" .
}
--14
@prefix dcterms: .
@prefix booksschema: .
@prefix books: .
DELETE {
?book booksschema:hasPrice "15" .
}
INSERT {
?book booksschema:hasPrice "8" .
} WHERE {
?book dcterms:creator ?author .
?author foaf:name "Melissa Da Costa" .
}