query-5e7e8f8710a0128211a6803a4530a6d5

rq turtle/ttl

Ship names with '('

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 ?classLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-gb,en,mul"}
  {
    SELECT DISTINCT ?item ?name ?class WHERE {
      ?item wdt:P31 wd:Q11446.
      ?item rdfs:label ?label. FILTER (lang(?label) = "en")
      OPTIONAL {
        ?item wdt:P1448 ?officialname.
      }
      BIND(COALESCE(?officialname,?label) AS ?name)
      FILTER(CONTAINS(?name, "(")).
      OPTIONAL { ?item wdt:P289 ?class.}
    }
    #LIMIT 100
  }
}

Query found at

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