query-f3d23e2a6820816c7af684351d5c3117

rq turtle/ttl

WD subject codes which have no match in PM20 endpoint

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX bd: <http://www.bigdata.com/rdf#>
select distinct ?item ?itemLabel ?subjectCode ?notation
where {
  ?item wdt:P8484 ?subjectCode .
  bind(replace(?subjectCode, '_', ' ') as ?notation)

  optional {
    service <http://zbw.eu/beta/sparql/pm20/query> {
      select distinct ?notation ?subject
      where {
        # it is not reqiered that according subject category has folders!
        # (may be empty level in the hierarchy)
        ?subject skos:notation ?notation .
      }
    }
  }
  filter(!bound(?subject))
  #
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
order by ?notation

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?item"):::projected v5("?notation"):::projected v2("?subject") v4("?subjectCode"):::projected c5(["bd:serviceParam"]):::iri c7(["en"]):::literal f0[["not bound(?subject)"]] f0 --> v2 v3 --"wdt:P8484"--> v4 bind1[/"replace(?subjectCode,'_',' ')"/] v4 --o bind1 bind1 --as--o v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; subgraph s1["http://zbw.eu/beta/sparql/pm20/query"] style s1 stroke-width:4px; v2 -."skos:notation".-> v5 end end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c5 --"wikibase:language"--> c7 end