query-aafbc0b9d08fa0c3966cb819a0c9f1c0

rq turtle/ttl

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

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

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?film"):::projected v5("?period") v4("?periodStatement") v10("?periodTime"):::projected v6("?periodTime1") v7("?periodTime2") v8("?periodTime3") v9("?periodTime4") v10("?pubDate"):::projected a1((" ")) c12(["bd:serviceParam"]):::iri c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q11424"]):::iri f0[["?periodTime >= ?pubDate?periodTime <= NOW()"]] f0 --> v10 f0 --> v10 v3 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v3 --"p:P2408"--> v4 v4 --"p:statement/P2408"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P1319".-> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P1326".-> v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:direct/P580".-> v8 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:direct/P585".-> v9 end bind1[/"?periodTime1?periodTime2?periodTime3?periodTime4"/] v6 --o bind1 v7 --o bind1 v8 --o bind1 v9 --o bind1 bind1 --as--o v10 v3 --"p:direct/P577"--> v10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end bind3[/"min(?pubDate)"/] v10 --o bind3 bind3 --as--o v10