query-ea6d6df53981b145bdc226ce1515e681

rq turtle/ttl

BestPictureWinners SELECT DISTINCT ?filmLabel ?duration ?film WHERE { ?film wdt:P31 wd:Q11424. #is a film ?film wdt:P166 wd:Q102427 . # won best picture

OPTIONAL {?film wdt:P57 ?director.} OPTIONAL {?film p:P2047 ?durationStatement.} OPTIONAL {?durationStatement ps:P2047 ?duration.} ?durationStatement a wikibase:BestRank. OPTIONAL {?durationStatement pq:P518 ?version.} #version: cut of film (e.g. director's cut)

FILTER(CONTAINS(?versionLabel, "theatrical")).

SERVICE wikibase:label { bd:serviceParam wikibase:language "en". ?film rdfs:label ?filmLabel. ?version rdfs:label ?versionLabel. } } ORDER BY (?filmLabel)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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#>
#BestPictureWinners
SELECT DISTINCT ?filmLabel ?duration ?film
WHERE 
{
  ?film wdt:P31 wd:Q11424. #is a film
  ?film wdt:P166 wd:Q102427 . # won best picture

  OPTIONAL {?film wdt:P57 ?director.}
  OPTIONAL {?film p:P2047 ?durationStatement.}
  OPTIONAL {?durationStatement ps:P2047 ?duration.}
            ?durationStatement a wikibase:BestRank.
  OPTIONAL {?durationStatement pq:P518 ?version.} #version: cut of film (e.g. director's cut)

  FILTER(CONTAINS(?versionLabel, "theatrical")).

  SERVICE wikibase:label { 
    bd:serviceParam wikibase:language "en".
    ?film rdfs:label ?filmLabel.
    ?version rdfs:label ?versionLabel.
  }
}
ORDER BY (?filmLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?director") v6("?duration"):::projected v5("?durationStatement") v3("?film"):::projected v1("?filmLabel"):::projected v7("?version") v2("?versionLabel") c10(["wikibase:BestRank"]):::iri c15(["en"]):::literal c13(["bd:serviceParam"]):::iri c5(["wd:Q102427"]):::iri c3(["wd:Q11424"]):::iri f0[["contains(?versionLabel,'theatrical')"]] f0 --> v2 v3 --"p:direct/P31"--> c3 v3 --"p:direct/P166"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P57".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:P2047".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:statement/P2047".-> v6 end v5 --"a"--> c10 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P518".-> v7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 v3 --"rdfs:label"--> v1 v7 --"rdfs:label"--> v2 end