query-b2a921c089cd6f8290df638aad464385

rq turtle/ttl

Royal Navy vessels with more operators than recorded in official names

Use at

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 ?item ?itemLabel ?itemDescription 
  (COUNT (DISTINCT ?oper) as ?c_oper) 
  (COUNT (DISTINCT ?o_oper) as ?co_oper) 
  (COUNT (DISTINCT ?official) as ?c_official) 
WHERE {
  ?item wdt:P31/wdt:P279* wd:Q177597.
  ?item wdt:P137 wd:Q172771.
  {?item wdt:P137 ?oper}
  ?item p:P1448 [ps:P1448 ?official; pq:P137 ?o_oper].

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-gb,en,mul". }             
} GROUP BY ?item ?itemLabel ?itemDescription 
HAVING (?c_oper > ?co_oper)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?c_official") v7("?c_oper") v7("?co_oper") v3("?item"):::projected v6("?o_oper"):::projected v5("?official"):::projected v4("?oper"):::projected a1((" ")) a2((" ")) c12(["en-gb,en,mul"]):::literal c10(["bd:serviceParam"]):::iri c3(["wd:Q177597"]):::iri c5(["wd:Q172771"]):::iri f0[["?c_oper > ?co_oper"]] f0 --> v7 f0 --> v7 v3 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v3 --"p:direct/P137"--> c5 v3 --"p:direct/P137"--> v4 a2 --"p:statement/P1448"--> v5 a2 --"p:qualifier/P137"--> v6 v3 --"p:P1448"--> a2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind4[/"count(?oper)"/] v4 --o bind4 bind4 --as--o v7 bind5[/"count(?o_oper)"/] v6 --o bind5 bind5 --as--o v7 bind6[/"count(?official)"/] v5 --o bind6 bind6 --as--o v7