query-2442d694da59413dd5f38305c6c2731a

rq turtle/ttl

title:One value with deprecated rank, no value with normal rank SELECT ?item ?itemLabel ?gnd ?msLabel WHERE { ?item p:P227 ?st . ?st wikibase:rank wikibase:DeprecatedRank . ?st ps:P227 ?gnd . OPTIONAL { ?st pq:P2241 ?ms . } MINUS { ?item p:P227 ?stt . ?stt wikibase:rank wikibase:NormalRank . } SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". } } ORDER BY ?ms

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
#title:One value with deprecated rank, no value with normal rank
SELECT ?item ?itemLabel ?gnd ?msLabel
WHERE {
 ?item p:P227 ?st .
 ?st wikibase:rank wikibase:DeprecatedRank .
 ?st ps:P227 ?gnd .
 OPTIONAL { ?st pq:P2241 ?ms . }
 MINUS { ?item p:P227 ?stt .
 ?stt wikibase:rank wikibase:NormalRank . }
 SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". }
}
ORDER BY ?ms

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?gnd"):::projected v2("?item"):::projected v1("?ms") v3("?st") v5("?stt") c8(["bd:serviceParam"]):::iri c3(["wikibase:DeprecatedRank"]):::iri c6(["wikibase:NormalRank"]):::iri c10(["de,en"]):::literal v2 --"p:P227"--> v3 v3 --"wikibase:rank"--> c3 v3 --"p:statement/P227"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P2241".-> v1 end subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v2 --"p:P227"--> v5 v5 --"wikibase:rank"--> c6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end