query-05aa3f3364b9913966110a5a88953584
List of companies by revenue
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 ?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 wd:Q4917
] .
BIND( wd:Q4917 AS ?unit ) .
BIND( ?revenue AS ?revenue_USD ) .
} UNION {
?statement psv:P2139 [
wikibase:quantityAmount ?revenue; wikibase:quantityUnit ?unit
] .
FILTER( ?unit != wd:Q4917 ) .
?unit p:P2284 ?unit_statement .
?unit_statement psv:P2284 [
wikibase:quantityUnit wd:Q4917; wikibase:quantityAmount ?usd
] .
FILTER NOT EXISTS { ?unit_statement wikibase:rank wikibase:DeprecatedRank } .
FILTER NOT EXISTS {
?unit p:P2284 ?unit_statement1 .
?unit_statement1 wikibase:rank wikibase:PreferredRank;
psv:P2284/wikibase:quantityUnit wd:Q4917 .
FILTER( ?unit_statement1 != ?unit_statement ) .
} .
BIND( ?revenue * ?usd AS ?revenue_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;
v6("?date"):::projected
v5("?hq")
v4("?item"):::projected
v7("?revenue"):::projected
v12("?revenue_USD"):::projected
v3("?statement")
v2("?statement1")
v8("?unit")
v10("?unit_statement")
v9("?unit_statement1")
v11("?usd")
a1((" "))
a3((" "))
a4((" "))
a2((" "))
c11(["wd:Q4917"]):::iri
c3(["wikibase:PreferredRank"]):::iri
c4(["wikibase:DeprecatedRank"]):::iri
c6(["wd:Q4830453"]):::iri
c18(["cs,en"]):::literal
c16(["bd:serviceParam"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["?statement1 != ?statement"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0v3 --"p:P2139"--> e0v1
e0v1 --"wikibase:rank"--> e0c3
e0v3("?item"):::projected
e0v2("?statement"):::projected
e0v1("?statement1"):::projected
e0c3(["wikibase:PreferredRank"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> v3
f0 --> v4
f0 --> c1
f0 --> c2
f0 --> c3
f1[["?statement1 != ?statement"]]
f1 --> v2
f1 --> v3
v4 --"p:P2139"--> v2
v2 --"wikibase:rank"--> c3
f2[["not "]]
subgraph f2e1["Exists Clause"]
e1v1 --"wikibase:rank"--> e1c2
e1v1("?statement"):::projected
e1c2(["wikibase:DeprecatedRank"]):::iri
end
f2--EXISTS--> f2e1
f2 --> v3
f2 --> c2
f2 --> c4
v3 --"wikibase:rank"--> c4
v4 --"p:direct/P31"--> c6
v4 --"p:direct/P159"--> v5
v4 --"p:P2139"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P585".-> v6
end
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
f3[["not "]]
subgraph f3e2["Exists Clause"]
e2f0[["?unit_statement1 != ?unit_statement"]]
e2f0 --> e2v1
e2f0 --> e2v2
e2v3 --"p:P2284"--> e2v1
e2v1 --"wikibase:rank"--> e2c3
e2v1 --"p:statement/value/P2284"--> e2a1
e2a1 --"wikibase:quantityUnit"--> e2c6
e2v3("?unit"):::projected
e2v2("?unit_statement"):::projected
e2v1("?unit_statement1"):::projected
e2a1((" ")):::projected
e2c6(["wd:Q4917"]):::iri
e2c3(["wikibase:PreferredRank"]):::iri
end
f3--EXISTS--> f3e2
f3 --> v9
f3 --> v10
f3 --> v8
f3 --> c13
f3 --> c2
f3 --> c3
f3 --> c14
f3 --> a2
f3 --> c10
f3 --> c11
f4[["?unit_statement1 != ?unit_statement"]]
f4 --> v9
f4 --> v10
v8 --"p:P2284"--> v9
v9 --"wikibase:rank"--> c3
v9 --"p:statement/value/P2284"--> a2
a2 --"wikibase:quantityUnit"--> c11
f5[["not "]]
subgraph f5e3["Exists Clause"]
e3v1 --"wikibase:rank"--> e3c2
e3v1("?unit_statement"):::projected
e3c2(["wikibase:DeprecatedRank"]):::iri
end
f5--EXISTS--> f5e3
f5 --> v10
f5 --> c2
f5 --> c4
v10 --"wikibase:rank"--> c4
f6[["?unit != 'wd:Q4917'"]]
f6 --> v8
a3 --"wikibase:quantityAmount"--> v7
a3 --"wikibase:quantityUnit"--> v8
v3 --"p:statement/value/P2139"--> a3
v8 --"p:P2284"--> v10
a4 --"wikibase:quantityUnit"--> c11
a4 --"wikibase:quantityAmount"--> v11
v10 --"p:statement/value/P2284"--> a4
bind7[/"?revenue * ?usd"/]
v7 --o bind7
v11 --o bind7
bind7 --as--o v12
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
a1 --"wikibase:quantityAmount"--> v7
a1 --"wikibase:quantityUnit"--> c11
v3 --"p:statement/value/P2139"--> a1
bind8[/"'wd:Q4917'"/]
bind8 --as--o v8
bind9[/"?revenue"/]
v7 --o bind9
bind9 --as--o v12
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c16 --"wikibase:language"--> c18
end