query-5fa755d637d5a5b7afdf6a8b70185c2c
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 psv: <http://www.wikidata.org/prop/statement/value/>
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 ?revenue ?unitLabel ?hqLabel (?usd * ?revenue AS ?revenue_USD) ?date
WHERE
{
?item wdt:P31 wd:Q4830453;
wdt:P159 ?hq;
p:P2139 ?statement .
FILTER NOT EXISTS { ?statement wikibase:rank wikibase:DeprecatedRank } .
FILTER NOT EXISTS {
?item p:P2139 ?statement1 .
?statement1 wikibase:rank wikibase:PreferredRank .
FILTER( ?statement1 != ?statement ) .
} .
OPTIONAL { ?statement pq:P585 ?date } .
?statement psv:P2139 [
wikibase:quantityAmount ?revenue; wikibase:quantityUnit ?unit
] .
?unit p:P2284 ?unit_statement .
FILTER NOT EXISTS { ?unit_statement wikibase:rank wikibase:DeprecatedRank } .
FILTER NOT EXISTS {
?unit p:P2284 ?unit_statement1 .
?unit_statement1 wikibase:rank wikibase:PreferredRank .
FILTER( ?unit_statement1 != ?unit_statement ) .
} .
?unit_statement psv:P2284 [
wikibase:quantityUnit wd:Q4917; wikibase:quantityAmount ?usd
] .
SERVICE wikibase:label { bd:serviceParam wikibase:language "cs,en" } .
}
ORDER BY DESC(?revenue_USD)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?date"):::projected
v8("?hq")
v7("?item"):::projected
v10("?revenue"):::projected
v12("?revenue_USD")
v6("?statement")
v5("?statement1")
v4("?unit")
v3("?unit_statement")
v2("?unit_statement1")
v11("?usd"):::projected
a1((" "))
a2((" "))
c13(["wd:Q4917"]):::iri
c3(["wikibase:PreferredRank"]):::iri
c4(["wikibase:DeprecatedRank"]):::iri
c7(["wd:Q4830453"]):::iri
c18(["cs,en"]):::literal
c16(["bd:serviceParam"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["?unit_statement1 != ?unit_statement"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0v3 --"p:P2284"--> e0v1
e0v1 --"wikibase:rank"--> e0c3
e0v3("?unit"):::projected
e0v2("?unit_statement"):::projected
e0v1("?unit_statement1"):::projected
e0c3(["wikibase:PreferredRank"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> v3
f0 --> v4
f0 --> c1
f0 --> c2
f0 --> c3
f1[["?unit_statement1 != ?unit_statement"]]
f1 --> v2
f1 --> v3
v4 --"p:P2284"--> v2
v2 --"wikibase:rank"--> c3
f2[["not "]]
subgraph f2e1["Exists Clause"]
e1v1 --"wikibase:rank"--> e1c2
e1v1("?unit_statement"):::projected
e1c2(["wikibase:DeprecatedRank"]):::iri
end
f2--EXISTS--> f2e1
f2 --> v3
f2 --> c2
f2 --> c4
v3 --"wikibase:rank"--> c4
f3[["not "]]
subgraph f3e2["Exists Clause"]
e2f0[["?statement1 != ?statement"]]
e2f0 --> e2v1
e2f0 --> e2v2
e2v3 --"p:P2139"--> e2v1
e2v1 --"wikibase:rank"--> e2c3
e2v3("?item"):::projected
e2v2("?statement"):::projected
e2v1("?statement1"):::projected
e2c3(["wikibase:PreferredRank"]):::iri
end
f3--EXISTS--> f3e2
f3 --> v5
f3 --> v6
f3 --> v7
f3 --> c5
f3 --> c2
f3 --> c3
f4[["?statement1 != ?statement"]]
f4 --> v5
f4 --> v6
v7 --"p:P2139"--> v5
v5 --"wikibase:rank"--> c3
f5[["not "]]
subgraph f5e3["Exists Clause"]
e3v1 --"wikibase:rank"--> e3c2
e3v1("?statement"):::projected
e3c2(["wikibase:DeprecatedRank"]):::iri
end
f5--EXISTS--> f5e3
f5 --> v6
f5 --> c2
f5 --> c4
v6 --"wikibase:rank"--> c4
v7 --"p:direct/P31"--> c7
v7 --"p:direct/P159"--> v8
v7 --"p:P2139"--> v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:qualifier/P585".-> v9
end
a1 --"wikibase:quantityAmount"--> v10
a1 --"wikibase:quantityUnit"--> v4
v6 --"p:statement/value/P2139"--> a1
v4 --"p:P2284"--> v3
a2 --"wikibase:quantityUnit"--> c13
a2 --"wikibase:quantityAmount"--> v11
v3 --"p:statement/value/P2284"--> a2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c16 --"wikibase:language"--> c18
end
bind6[/"?usd * ?revenue"/]
v11 --o bind6
v10 --o bind6
bind6 --as--o v12