query-138e785542f4443cdc3db21ac06c8605

rq turtle/ttl

DE RAL, jurisdictions and courts. Wikidata:Property_proposal/XJustiz_registration_court_IDPicking up from : thanks for importing DE RAL codes and moving them to DE courts! But the query below shows some problems: RShigapovHi @The Jurisdiction of the rest is a mess: "Hesse" comes up too many times, and it's unset too many times. The first 5 don't have "country: DE"

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
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 ?co ?jurLabel ?ral ?item ?itemLabel  WHERE {
  ?item p:P9487 ?stat.
  ?stat ps:P9487 ?ral
  optional {?item wdt:P17/wdt:P297 ?co}
  filter(!bound(?co) || ?co="DE")
  optional {?stat pq:P1001 ?jur1}
  optional {?item wdt:P1001 ?jur2}
  bind(coalesce(?jur1,?jur2) as ?jur)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,bg,no,nn,nb" } .
} order by ?co ?ral ?jurLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?co"):::projected v4("?item"):::projected v8("?jur") v6("?jur1") v7("?jur2") v3("?jurLabel"):::projected v2("?ral"):::projected v5("?stat") a1((" ")) c9(["bd:serviceParam"]):::iri c11(["en,de,bg,no,nn,nb"]):::literal f0[["(not bound(?co) || ?co = 'DE')"]] f0 --> v1 v4 --"p:P9487"--> v5 v5 --"p:statement/P9487"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:direct/P17".-> a1 a1 --"p:direct/P297"--> v1 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P1001".-> v6 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:direct/P1001".-> v7 end bind1[/"?jur1?jur2"/] v6 --o bind1 v7 --o bind1 bind1 --as--o v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end