query-9ea774fd607526e4964f2cce7392fd74

rq turtle/ttl

Married couples who are parliamentarians in different countries to each other) — a query to find all cross-border parliamentarian couples: (Q795477)Prime Minister of Denmark ((Q57652)Helle Thorning-Schmidt , is married to (Q3377178)Stephen Kinnock , a (Q3377178)Stephen Kinnock Inspired by discovering that

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#>
SELECT DISTINCT ?person1 ?person1Label ?position1 ?position1Label ?person2 ?person2Label ?position2 ?position2Label
WHERE { 
  ?position1 wdt:P279* wd:Q4175034 ; wdt:P1001 ?country1 .
  ?position2 wdt:P279* wd:Q4175034 ; wdt:P1001 ?country2 .

  ?country1 wdt:P31 wd:Q6256.
  ?country2 wdt:P31 wd:Q6256.

  ?person1 wdt:P39 ?position1 ; wdt:P21 wd:Q6581072 .
  ?person2 wdt:P39 ?position2 ; wdt:P26 ?person1 .
  FILTER (?country1 != ?country2)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?country1") v2("?country2") v5("?person1"):::projected v6("?person2"):::projected v3("?position1"):::projected v4("?position2"):::projected c13(["en"]):::literal c8(["wd:Q6581072"]):::iri c11(["bd:serviceParam"]):::iri c5(["wd:Q6256"]):::iri c2(["wd:Q4175034"]):::iri f0[["?country1 != ?country2"]] f0 --> v1 f0 --> v2 v3 --"wdt:P279"--> c2 v3 --"wdt:P1001"--> v1 v4 --"wdt:P279"--> c2 v4 --"wdt:P1001"--> v2 v1 --"wdt:P31"--> c5 v2 --"wdt:P31"--> c5 v5 --"wdt:P39"--> v3 v5 --"wdt:P21"--> c8 v6 --"wdt:P39"--> v4 v6 --"wdt:P26"--> v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end