query-dae81929b9d74ee89afb27ae92f7d350

rq turtle/ttl

items holding a position for an electoral district with a label matching their family name SELECT DISTINCT ?item ?name ?label WHERE { ?item p:P39/pq:P768/rdfs:label ?label; wdt:P734/rdfs:label ?label. filter(lang(?label)="en") ?item rdfs:label ?name . filter(lang(?name)="en") }

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
# items holding a position for an electoral district with a label matching their family name
SELECT DISTINCT ?item ?name ?label WHERE {
  ?item p:P39/pq:P768/rdfs:label ?label;
         wdt:P734/rdfs:label ?label.
  filter(lang(?label)="en")
  ?item rdfs:label ?name .  filter(lang(?name)="en")
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?item"):::projected v2("?label"):::projected v1("?name"):::projected a1((" ")) a2((" ")) a3((" ")) f0[["?name = 'en'"]] f0 --> v1 f1[["?label = 'en'"]] f1 --> v2 v3 --"p:P39"--> a1 a1 --"p:qualifier/P768"--> a2 a2 --"rdfs:label"--> v2 v3 --"p:direct/P734"--> a3 a3 --"rdfs:label"--> v2 v3 --"rdfs:label"--> v1