query-98c638e58a35bdb25cc33ea355093c38

rq turtle/ttl

Related companies

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#>
PREFIX target: <http://www.wikidata.org/entity/Q22723716>

SELECT 
  ?subjects

  ?company ?companyLabel
  (CONCAT("#company/", SUBSTR(STR(?company), 32)) AS ?companyUrl)

  ?example_subject ?example_subjectLabel
WHERE {
   {
  SELECT 
    (COUNT(?subject) AS ?subjects)
    ?company
    (SAMPLE(?subject) AS ?example_subject)
  WHERE {
    ?subject ?property target: , ?company .
    ?property_item wikibase:directClaim ?property .
    FILTER (?company != target:)
  }
  GROUP BY ?company
}  VALUES ?company_type { wd:Q43229 wd:Q157031 wd:Q4830453 }
  ?company wdt:P31 ?company_type .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY DESC(?subjects)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?company"):::projected v8("?companyUrl") v7("?company_type") v6("?example_subject"):::projected v4("?property") v5("?property_item") v3("?subject") v6("?subjects"):::projected c5(["bd:serviceParam"]):::iri c1(["wd:Q22723716"]):::iri c7(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal f0[["?company != 'wd:Q22723716'"]] f0 --> v2 v3 -->v4--> c1 v3 -->v4--> v2 v5 --"wikibase:directClaim"--> v4 bind3[/"count(?subject)"/] v3 --o bind3 bind3 --as--o v6 bind4[/"sample(?subject)"/] v3 --o bind4 bind4 --as--o v6 bind5[/VALUES ?company_type/] bind5-->v7 bind50(["wd:Q43229"]) bind50 --> bind5 bind51(["wd:Q157031"]) bind51 --> bind5 bind52(["wd:Q4830453"]) bind52 --> bind5 v2 --"wdt:P31"--> v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end bind6[/"concat('#company/',substring(str(?company),'32^^xsd:integer'))"/] v2 --o bind6 bind6 --as--o v8