query-ab8a62ced79f4113d8249b75c14be9d5
TODO
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#>
SELECT ?item ?itemLabel (YEAR(?time) as ?year) ?IMDb_ID
WHERE {
?item wdt:P31 wd:Q11424;
p:P166 ?oscar_statement.
?oscar_statement ps:P166 wd:Q103360;
pq:P585 ?time.
OPTIONAL { ?item wdt:P345 ?IMDb_ID. }
# Use only truthy statements - not really needed here, but for good measure
?oscar_statement wikibase:rank ?rank.
FILTER (?rank = wikibase:PreferredRank ||
(?rank = wikibase:NormalRank && NOT EXISTS { ?item p:P166/wikibase:rank wikibase:PreferredRank. } )
)
# Add condition for year
FILTER (YEAR(?time) > 2010)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?IMDb_ID"):::projected
v3("?item"):::projected
v4("?oscar_statement")
v2("?rank")
v1("?time"):::projected
v6("?year")
a1((" "))
c2(["wikibase:PreferredRank"]):::iri
c9(["wd:Q103360"]):::iri
c15(["en"]):::literal
c13(["bd:serviceParam"]):::iri
c7(["wd:Q11424"]):::iri
f0[["year-from-dateTime(?time) > '2010^^xsd:integer'"]]
f0 --> v1
f1[["(?rank = 'wikibase:PreferredRank' || ?rank = 'wikibase:NormalRank'not )"]]
subgraph f1e0["Exists Clause"]
e0v1 --"p:P166"--> e0a1
e0a1 --"wikibase:rank"--> e0c3
e0v1("?item"):::projected
e0a1((" ")):::projected
e0c3(["wikibase:PreferredRank"]):::iri
end
f1--EXISTS--> f1e0
f1 --> v2
f1 --> v3
f1 --> c4
f1 --> a1
f1 --> c5
f1 --> c2
v3 --"p:P166"--> a1
a1 --"wikibase:rank"--> c2
v3 --"p:direct/P31"--> c7
v3 --"p:P166"--> v4
v4 --"p:statement/P166"--> c9
v4 --"p:qualifier/P585"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P345".-> v5
end
v4 --"wikibase:rank"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end
bind2[/"year-from-dateTime(?time)"/]
v1 --o bind2
bind2 --as--o v6