query-aafbc0b9d08fa0c3966cb819a0c9f1c0
movies which were set in the future when they were releast, but this future is now in the past SELECT ?film ?filmLabel (MIN(?pubDate) AS ?pubDate) ?periodTime WHERE { #instance of film (or any subclass) ?film wdt:P31/wdt:P279* wd:Q11424. #set in a period ?film p:P2408 ?periodStatement. ?periodStatement ps:P2408 ?period. #either the period statement has an earliest date (P1319) or latest date (P1326) qualifier OPTIONAL { ?periodStatement pq:P1319 ?periodTime1. } OPTIONAL { ?periodStatement pq:P1326 ?periodTime2. } #or the period has a start time(P580) or a point in time (P585) OPTIONAL { ?period wdt:P580 ?periodTime3. } OPTIONAL { ?period wdt:P585 ?periodTime4. } BIND(COALESCE(?periodTime1, ?periodTime2, ?periodTime3, ?periodTime4) AS ?periodTime)
#film has a publication date ?film wdt:P577 ?pubDate. #period is after publication date but before current time FILTER ((?periodTime >= ?pubDate) && (?periodTime <= NOW())) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?film ?filmLabel ?periodTime
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#movies which were set in the future when they were releast, but this future is now in the past
SELECT ?film ?filmLabel (MIN(?pubDate) AS ?pubDate) ?periodTime WHERE {
#instance of film (or any subclass)
?film wdt:P31/wdt:P279* wd:Q11424.
#set in a period
?film p:P2408 ?periodStatement.
?periodStatement ps:P2408 ?period.
#either the period statement has an earliest date (P1319) or latest date (P1326) qualifier
OPTIONAL { ?periodStatement pq:P1319 ?periodTime1. }
OPTIONAL { ?periodStatement pq:P1326 ?periodTime2. }
#or the period has a start time(P580) or a point in time (P585)
OPTIONAL { ?period wdt:P580 ?periodTime3. }
OPTIONAL { ?period wdt:P585 ?periodTime4. }
BIND(COALESCE(?periodTime1, ?periodTime2, ?periodTime3, ?periodTime4) AS ?periodTime)
#film has a publication date
?film wdt:P577 ?pubDate.
#period is after publication date but before current time
FILTER ((?periodTime >= ?pubDate) && (?periodTime <= NOW()))
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?film ?filmLabel ?periodTime