query-099ff20c9f004821cfed717f88686569

rq turtle/ttl

TODO

Use at

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  ?item ?itemLabel ?industryLabel ?countryLabel ?subsidiaryLabel ?total_assets 
WHERE {
  # get items whose parent is in the petroleum business
  { ?item wdt:P31/wdt:P279* wd:Q43229 .
    ?item wdt:P749 ?parent .
    ?parent wdt:P452 wd:Q862571 .
  }
UNION
  # get items which are in the petroleum business
  {
    ?item wdt:P452 wd:Q862571 .
  }
UNION
  # get items that are subsidiaries of items that are the petroleum business
  {
    ?parent wdt:P452 wd:Q862571.
    ?parent wdt:P355 ?item.
  }

  OPTIONAL { ?item wdt:P452 ?industry. }
  OPTIONAL { ?item wdt:P17 ?country. }
  OPTIONAL { ?item wdt:P355 ?subsidiary. }
  OPTIONAL { ?item wdt:P2403 ?total_assets. }

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; v4("?country") v3("?industry") v1("?item"):::projected v2("?parent") v5("?subsidiary") v6("?total_assets"):::projected a1((" ")) c3(["wd:Q43229"]):::iri c11(["bd:serviceParam"]):::iri c6(["wd:Q862571"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P452"--> c6 v2 --"wdt:P355"--> v1 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P452"--> c6 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P749"--> v2 v2 --"wdt:P452"--> c6 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P452".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P17".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P355".-> v5 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P2403".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end