query-b5d3f20cbb86ef0983c33721e8f03600
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 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 ?company ?companyLabel ?town ?revenue ?revDate ?fedSubjectLabel ?rank
WHERE
{
?company wdt:P31/wdt:P279* wd:Q4830453. #all businesses
?company p:P2139 [ ps:P2139 ?revenue; pq:P585 ?revDate; wikibase:rank ?rank].
minus {?company p:P2139 / wikibase:rank wikibase:DeprecatedRank .}
?company wdt:P159 ?town.
?town wdt:P131* ?fedSubject.
{?fedSubject wdt:P31 wd:Q835714.}
union
{?fedSubject wdt:P31 wd:Q41162. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ru". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?company"):::projected
v6("?fedSubject")
v4("?rank"):::projected
v3("?revDate"):::projected
v2("?revenue"):::projected
v5("?town"):::projected
a1((" "))
a2((" "))
a3((" "))
c11(["wd:Q835714"]):::iri
c12(["wd:Q41162"]):::iri
c16(["en,ru"]):::literal
c3(["wd:Q4830453"]):::iri
c8(["wikibase:DeprecatedRank"]):::iri
c14(["bd:serviceParam"]):::iri
v1 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
a2 --"p:statement/P2139"--> v2
a2 --"p:qualifier/P585"--> v3
a2 --"wikibase:rank"--> v4
v1 --"p:P2139"--> a2
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v1 --"p:P2139"--> a3
a3 --"wikibase:rank"--> c8
end
v1 --"p:direct/P159"--> v5
v5 --"p:direct/P131"--> v6
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v6 --"p:direct/P31"--> c12
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v6 --"p:direct/P31"--> c11
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end