query-7bb5dbe8dee4b156f5c0212270038615
duplicated instances of ambassadors to/of a country SELECT DISTINCT ?item ?itemLabel ?item1 ?item1Label ?item2 ?item2Label WHERE { {?item1 wdt:P279 wd:Q29645880.?item2 wdt:P279 wd:Q29645886}. FILTER (?item1 != ?item2). ?item wdt:P31 ?item1. ?item wdt:P31 ?item2. ?item_bis wdt:P31 ?item1. ?item_bis wdt:P31 ?item2. FILTER (?item != ?item_bis). SERVICE wikibase:label { bd:serviceParam wikibase:language "fr, en" } }
Use at
- https://query.wikidata.org/sparql
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#>
#duplicated instances of ambassadors to/of a country
SELECT DISTINCT ?item ?itemLabel ?item1 ?item1Label ?item2 ?item2Label
WHERE
{
{?item1 wdt:P279 wd:Q29645880.?item2 wdt:P279 wd:Q29645886}.
FILTER (?item1 != ?item2).
?item wdt:P31 ?item1.
?item wdt:P31 ?item2.
?item_bis wdt:P31 ?item1.
?item_bis wdt:P31 ?item2.
FILTER (?item != ?item_bis).
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr, en" }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v3("?item1"):::projected
v4("?item2"):::projected
v2("?item_bis")
c8(["fr, en"]):::literal
c6(["bd:serviceParam"]):::iri
c3(["wd:Q29645886"]):::iri
c2(["wd:Q29645880"]):::iri
f0[["?item != ?item_bis"]]
f0 --> v1
f0 --> v2
f1[["?item1 != ?item2"]]
f1 --> v3
f1 --> v4
v3 --"wdt:P279"--> c2
v4 --"wdt:P279"--> c3
v1 --"wdt:P31"--> v3
v1 --"wdt:P31"--> v4
v2 --"wdt:P31"--> v3
v2 --"wdt:P31"--> v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end