query-8d7202e555d4b0257159485ed2bc0763
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 ?company ?companyLabel ?hqLocationLabel ?territorialEntityLabel
WHERE
{
{
SELECT ?company
WHERE
{
?company wdt:P17 wd:Q30 .
FILTER (?company IN (wd:Q95, wd:Q37156)) #Google/IBM
}
} ?company wdt:P159 ?hqLocation . # company headquarted location
?hqLocation wdt:P131+ ?territorialEntity . # located in territorial entity
?territorialEntity wdt:P31 wd:Q35657 . # territorial entity is instance of 'state'
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("?company"):::projected
v2("?hqLocation")
v3("?territorialEntity")
c10(["bd:serviceParam"]):::iri
c4(["wd:Q30"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c8(["wd:Q35657"]):::iri
list0c1(["wd:Q95"]):::iri
list0c2(["wd:Q37156"]):::iri
list0c1 --o f0
list0c2 --o f0
f0[[" in "]]
f0 --> v1
v1 --"wdt:P17"--> c4
v1 --"wdt:P159"--> v2
v2 --"wdt:P131"--> v3
v3 --"wdt:P31"--> c8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end