An introduction to RDF querying in SPARQL
Zwifi
22K views
Optional graph patterns
Who are the movies and their release date?
1
2
3
4
5
6
7
8
9
10
PREFIX yaco: <https://www.irit.fr/recherches/MELODI/ontologies/cinema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?movie ?year
WHERE {
?movie rdf:type yaco:Movie;
yaco:releaseYear ?year.
}
1
@prefix yaco: <https://www.irit.fr/recherches/MELODI/ontologies/cinema#> .
Who are the movies and their POTENTIAL release date?
1
2
3
4
5
6
7
8
9
10
11
12
PREFIX yaco: <https://www.irit.fr/recherches/MELODI/ontologies/cinema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?movie ?year
WHERE {
?movie rdf:type yaco:Movie;
OPTIONAL {
?movie yaco:releaseYear ?year.
}
}
1
@prefix yaco: <https://www.irit.fr/recherches/MELODI/ontologies/cinema#> .
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.