query-0b10a717204c773bec655385eb59d42b

rq turtle/ttl

Postal codes of MD SELECT ?item ?itemLabel ?cp WHERE { ?item wdt:P17 wd:Q217 . ?item wdt:P281 ?cp . FILTER NOT EXISTS { ?item wdt:P281 ?cp ; FILTER(strStarts(?cp, "MD")) . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } Order BY ASC(?class)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Postal codes of MD
SELECT ?item ?itemLabel ?cp WHERE {
 ?item wdt:P17 wd:Q217 . 
 ?item wdt:P281 ?cp .
 FILTER NOT EXISTS { ?item wdt:P281 ?cp ; FILTER(strStarts(?cp, "MD")) . }
 SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Order BY ASC(?class)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?class") v2("?cp"):::projected v3("?item"):::projected c6(["bd:serviceParam"]):::iri c4(["wd:Q217"]):::iri c8(["en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0f0[["starts-with(?cp,'MD')"]] e0f0 --> e0v1 e0v2 --"wdt:P281"--> e0v1 e0v1("?cp"):::projected e0v2("?item"):::projected end f0--EXISTS--> f0e0 f0 --> v2 f0 --> v3 f0 --> c2 f1[["starts-with(?cp,'MD')"]] f1 --> v2 v3 --"wdt:P281"--> v2 v3 --"wdt:P17"--> c4 v3 --"wdt:P281"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end