query-66012196e489c8fa3d907272991f423e
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?prodco ?prodcoLabel (SUM(?boxOffice - ?cost) as ?totalNetProfit)
WHERE
{
?art wdt:P272 ?prodco. # art produced by production companies
?art wdt:P31 wd:Q11424. # ensure that the art produced is an instance of film
?art wdt:P495 ?countryOfOrigin. # counbtry of origin of the art
?art wdt:P2142 ?boxOffice. # get the box office earnings for the fil
?art wdt:P2130 ?cost. # Find the cost of each art
#Does this make sure all companies that didn't produce ANY film in USA are removed?
FILTER (?countryOfOrigin != wd:Q30) # Ensure that the film does not originate from USA.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?prodco ?prodcoLabel
ORDER BY desc(?totalNetProfit)
LIMIT 20
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?art")
v5("?boxOffice"):::projected
v6("?cost"):::projected
v2("?countryOfOrigin")
v4("?prodco"):::projected
v7("?totalNetProfit")
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c4(["wd:Q11424"]):::iri
f0[["?countryOfOrigin != 'wd:Q30'"]]
f0 --> v2
v3 --"wdt:P272"--> v4
v3 --"wdt:P31"--> c4
v3 --"wdt:P495"--> v2
v3 --"wdt:P2142"--> v5
v3 --"wdt:P2130"--> v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind2[/"sum(?boxOffice - ?cost)"/]
v5 --o bind2
v6 --o bind2
bind2 --as--o v7