query-285c15e57c52239d86513c83897d51cc

rq turtle/ttl

TODO

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#>
SELECT DISTINCT ?actorLabel ?actor_IMBD ?movieLabel ?movie_IMBD ?awardLabel ?movie
{
  VALUES ?award {
    wd:Q106301 # Academy Award for Best Supporting Actress
    wd:Q103618 # Academy Award for Best Actress
    # Add more awards here
  }
  {
    # The award statement is normal placed at the actor
    ?actor p:P166 ?award_statement .
    ?award_statement ps:P166 ?award .
    ?award_statement pq:P1686 ?movie . # "for work" qualifier
  }
  UNION
  {
    # The award statement is also sometimes placed at movie
    ?movie p:P166 ?award_statement .
    ?award_statement ps:P166 ?award .
    ?award_statement pq:P1346 ?actor . # "winner" qualifier
  }
  OPTIONAL { ?movie wdt:P345 ?movie_IMBD . }
  OPTIONAL { ?actor wdt:P345 ?actor_IMBD . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?actor") v6("?actor_IMBD"):::projected v1("?award") v3("?award_statement") v4("?movie"):::projected v5("?movie_IMBD"):::projected c7(["bd:serviceParam"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?award/] bind0-->v1 bind00(["wd:Q106301"]) bind00 --> bind0 bind01(["wd:Q103618"]) bind01 --> bind0 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"p:P166"--> v3 v3 --"p:statement/P166"--> v1 v3 --"p:qualifier/P1346"--> v2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"p:P166"--> v3 v3 --"p:statement/P166"--> v1 v3 --"p:qualifier/P1686"--> v4 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:direct/P345".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P345".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end