query-6e449371817c7c5ef0f00a64f02349da

rq turtle/ttl

Royal Navy vessels called ships, when they could be more specific

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 p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?classtype ?classLabel ?classtypeLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-gb,en,mul". }
  {
    SELECT DISTINCT ?item ?class ?classtype WHERE {
      ?item wdt:P137  wd:Q172771.
      ?item wdt:P31 wd:Q11446.
      ?item p:P289 ?statement1.
      ?statement1 ps:P289 ?class.
      ?class wdt:P279 ?classtype.
      #?item wdt:P31 wd:Q11446.
      #?item p:P289 ?statement2.
      #?statement2 (ps:P289/(wdt:P279*)) _:anyValueP289.
    }
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?class") v4("?classtype"):::projected v1("?item"):::projected v2("?statement1") c4(["en-gb,en,mul"]):::literal c2(["bd:serviceParam"]):::iri c8(["wd:Q11446"]):::iri c6(["wd:Q172771"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v1 --"p:direct/P137"--> c6 v1 --"p:direct/P31"--> c8 v1 --"p:P289"--> v2 v2 --"p:statement/P289"--> v3 v3 --"p:direct/P279"--> v4