query-1d5d5c4c5ce5ed953a9e016880edc63c

rq turtle/ttl

TODO

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?owner ?ownerLabel ?owned ?ownedLabel                                       # the query dumps its results into %i
where
{                                                 # this is the second query, which works from the %i list

{
  SELECT DISTINCT ?owner ?ownerLabel WHERE        # this is the named subquery
   {
     wd:Q3295867 wdt:P127 ?owner .                # get the direct owners of Coca-Cola
 #    wd:Q1093541 wdt:P127* ?owner .              # get the ownership tree for IBM Cloud Video
     ?owner rdfs:label ?ownerLabel. filter(lang(?ownerLabel)='en')       
  } }    
  ?owned wdt:P127+ ?owner .                       # finds all companies owned (or recursively owned - P127+ ) by the companies 
                                                  # that own Coca-Cola or IBM Cloud Video (depending on which variant you're running)
  ?owned rdfs:label ?ownedLabel. filter(lang(?ownedLabel)='en')  
} order by ?ownerLabel ?ownedLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?owned"):::projected v2("?ownedLabel"):::projected v3("?owner"):::projected v1("?ownerLabel"):::projected c2(["wd:Q3295867"]):::iri f0[["?ownedLabel = 'en'"]] f0 --> v2 f1[["?ownerLabel = 'en'"]] f1 --> v1 c2 --"wdt:P127"--> v3 v3 --"rdfs:label"--> v1 v4 --"wdt:P127"--> v3 v4 --"rdfs:label"--> v2