query-27ca369a357c3e8045a89ae5f3c413c0

rq turtle/ttl

by CamelCaseNick select (replace(str(?stolperstein), str(wd:), "") as ?qid) ("Dde" as ?pid) (concat("\"", ?description, "\"") as ?vid) ?de where { ?stolperstein wdt:P31 wd:Q26703203; wdt:P131+ wd:Q1055; wdt:P276 ?quarter. filter exists { ?quarter wdt:P31 wd:Q15830667. } ?quarter rdfs:label ?qDe. filter(lang(?qDe) = "de") bind(concat("Stolperstein in ", if(strstarts(?qDe, "Hamburg-"), "", "Hamburg-"), ?qDe) as ?description) optional { ?stolperstein schema:description ?de. filter(lang(?de) = "de") } filter not exists { ?stolperstein schema:description ?de. filter(lang(?de) = "de" && (strstarts(?de, ?description) || strstarts(?de, concat("ehemaliger ", ?description)))) } }

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
#by CamelCaseNick
select (replace(str(?stolperstein), str(wd:), "") as ?qid) ("Dde" as ?pid) (concat(""", ?description, """) as ?vid) ?de where {
  ?stolperstein wdt:P31 wd:Q26703203;
                wdt:P131+ wd:Q1055;
                wdt:P276 ?quarter.
  filter exists {
    ?quarter wdt:P31 wd:Q15830667.
  }
  ?quarter rdfs:label ?qDe.
  filter(lang(?qDe) = "de")
  bind(concat("Stolperstein in ", if(strstarts(?qDe, "Hamburg-"), "", "Hamburg-"), ?qDe) as ?description)
  optional {
    ?stolperstein schema:description ?de.
    filter(lang(?de) = "de")
  }
  filter not exists {
    ?stolperstein schema:description ?de.
    filter(lang(?de) = "de" && (strstarts(?de, ?description) || strstarts(?de, concat("ehemaliger ", ?description))))
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?de"):::projected v6("?description") v7("?pid") v4("?qDe") v6("?qid") v5("?quarter") v3("?stolperstein"):::projected v8("?vid") c5(["wd:Q15830667"]):::iri c6(["wd:Q26703203"]):::iri c8(["wd:Q1055"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0f0[["?de = 'de'(starts-with(?de,?description) || starts-with(?de,concat('ehemaliger ',?description)))"]] e0f0 --> e0v1 e0f0 --> e0v2 e0v3 --"schema:description"--> e0v1 e0v1("?de"):::projected e0v2("?description"):::projected e0v3("?stolperstein"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> v6 f0 --> v3 f0 --> c3 f1[["?de = 'de'(starts-with(?de,?description) || starts-with(?de,concat('ehemaliger ',?description)))"]] f1 --> v1 f1 --> v6 v3 --"schema:description"--> v1 f2[["?qDe = 'de'"]] f2 --> v4 f3[[" "]] subgraph f3e1["Exists Clause"] e1v1 --"wdt:P31"--> e1c2 e1v1("?quarter"):::projected e1c2(["wd:Q15830667"]):::iri end f3--EXISTS--> f3e1 f3 --> v5 f3 --> c4 f3 --> c5 v5 --"wdt:P31"--> c5 v3 --"wdt:P31"--> c6 v3 --"wdt:P131"--> c8 v3 --"wdt:P276"--> v5 v5 --"rdfs:label"--> v4 bind4[/"concat('Stolperstein in ',if(starts-with(?qDe,'Hamburg-'),'','Hamburg-'),?qDe)"/] v4 --o bind4 bind4 --as--o v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."schema:description".-> v1 end bind5[/"replace(str(?stolperstein),str('wd:'),'')"/] v3 --o bind5 bind5 --as--o v6 bind6[/"'Dde'"/] bind6 --as--o v7 bind7[/"concat(', ?description, ')"/] bind7 --as--o v8