Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Identifying graph pattern you don't want
The 'old' way: negation by optionality
What are the movies without a release date?
1
2
3
4
5
6
7
8
9
10
11
12
13
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
}
FILTER(!bound(?year))
}
Enter to Rename, Shift+Enter to Preview
1
@prefix yaco: <https://www.irit.fr/recherches/MELODI/ontologies/cinema#> .
Enter to Rename, Shift+Enter to Preview
Be careful with the scope:
What are the movies that were not released in 1997?
1
2
3
4
5
6
7
8
9
10
11
12
13
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
}
FILTER(?year != 1997)
}
Enter to Rename, Shift+Enter to Preview
1
@prefix yaco: <https://www.irit.fr/recherches/MELODI/ontologies/cinema#> .
Enter to Rename, Shift+Enter to Preview
What are the movies that were not released in 1997?
1
2
3
4
5
6
7
8
9
10
11
12
13
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
FILTER(?year != 1997)
}
}
Enter to Rename, Shift+Enter to Preview
1
@prefix yaco: <https://www.irit.fr/recherches/MELODI/ontologies/cinema#> .
Enter to Rename, Shift+Enter to Preview
Negating with NOT EXISTS
What are the movies without Tom Hanks?
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 : <https://www.irit.fr/recherches/MELODI/ontologies/cinema-catalog#>
SELECT ?movie
WHERE {
?movie rdf:type yaco:Movie.
FILTER NOT EXISTS{
:TomHanks yaco:isFeaturedIn ?movie.
}
}
Enter to Rename, Shift+Enter to Preview
1
@prefix yaco: <https://www.irit.fr/recherches/MELODI/ontologies/cinema#> .
Enter to Rename, Shift+Enter to Preview
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content