query-da32699e1ba07aca00f3bac4865b5447

rq turtle/ttl

Adding offical name for all ships with compromised labels (mul) to add the clean ship "Yamoto" name to these entries. This could also be used to record how a ship hull changes name (see another thread above) due to sale or capture. To get official name, defaulting to label, run (P1448)official name Various ship labels are compromised with extra information like "Japanese battleship Yamato" (see thread above). I am using the

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?name WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
  {
    SELECT DISTINCT ?item ?name WHERE {
      ?item wdt:P31 wd:Q7642168.
      ?item rdfs:label ?label. FILTER (lang(?label) = "en")
      OPTIONAL {
        ?item wdt:P1448 ?officialname.
      }
      BIND(COALESCE(?officialname,?label) AS ?name)
    }
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v1("?label") v4("?name"):::projected v3("?officialname") c2(["bd:serviceParam"]):::iri c4(["en"]):::literal c6(["wd:Q7642168"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end f0[["?label = 'en'"]] f0 --> v1 v2 --"wdt:P31"--> c6 v2 --"rdfs:label"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P1448".-> v3 end bind1[/"?officialname?label"/] v3 --o bind1 v1 --o bind1 bind1 --as--o v4