query-47bc714e05dbf508d4fad42383b60a2b

rq turtle/ttl

actors or actresses who have won an Oscar (Acadamy Award) for playing an Oscar winner SELECT DISTINCT ?actorA ?actorALabel ?movie ?movieLabel ?actorB ?actorBLabel WHERE { ?actorA wdt:P166/wdt:P31 wd:Q19020. ?award wdt:P31 wd:Q19020. ?actorB p:P166 ?awardStatement. ?awardStatement ps:P166 ?award. #put a comment in front of the line below to show all oscar winners portait by oscar winners ?awardStatement pq:P1686 ?movie. ?movie p:P161 ?castStatement. ?castStatement ps:P161 ?actorB. ?castStatement pq:P453 ?actorA. FILTER (?actorA != ?actorB) #this line is only in here to filter out actors/actresses who play themselves when the condition is removed that the Oscar had to be won for the same movie

SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

}

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#>
#actors or actresses who have won an Oscar (Acadamy Award) for playing an Oscar winner
SELECT DISTINCT ?actorA ?actorALabel ?movie ?movieLabel ?actorB ?actorBLabel WHERE {
    ?actorA wdt:P166/wdt:P31 wd:Q19020.
    ?award wdt:P31 wd:Q19020.
    ?actorB p:P166 ?awardStatement.
    ?awardStatement ps:P166 ?award.
    #put a comment in front of the line below to show all oscar winners portait by oscar winners
    ?awardStatement pq:P1686 ?movie.
    ?movie p:P161 ?castStatement.
    ?castStatement ps:P161 ?actorB.
    ?castStatement pq:P453 ?actorA.
    FILTER (?actorA != ?actorB) #this line is only in here to filter out actors/actresses who play themselves when the condition is removed that the Oscar had to be won for the same movie

    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; v1("?actorA"):::projected v2("?actorB"):::projected v3("?award") v4("?awardStatement") v6("?castStatement") v5("?movie"):::projected a1((" ")) c3(["wd:Q19020"]):::iri c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?actorA != ?actorB"]] f0 --> v1 f0 --> v2 v1 --"p:direct/P166"--> a1 a1 --"p:direct/P31"--> c3 v3 --"p:direct/P31"--> c3 v2 --"p:P166"--> v4 v4 --"p:statement/P166"--> v3 v4 --"p:qualifier/P1686"--> v5 v5 --"p:P161"--> v6 v6 --"p:statement/P161"--> v2 v6 --"p:qualifier/P453"--> v1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end