query-9fbc9f39fd8011ac7fdcc99ca32ee58b
item with (ambassador of x) or (ambassador of y) as P279
(probably instead of P31)
SELECT distinct ?item ?itemLabel ?class ?classLabel where{ {?class wdt:wdt:P31 wd:Q29918328 .} union {?class wdt:P31 wd:Q29918335} ?item wdt:P279 ?class. SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" } FILTER NOT EXISTS { # know exceptions {?item wdt:P279 wd:Q30064715 } union {?item wdt:P279 wd:Q110620461 } } }
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#>
#item with (ambassador of x) or (ambassador of y) as P279
#(probably instead of P31)
SELECT distinct ?item ?itemLabel ?class ?classLabel where{
{?class wdt:wdt:P31 wd:Q29918328 .} union {?class wdt:P31 wd:Q29918335}
?item wdt:P279 ?class.
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" }
FILTER NOT EXISTS { # know exceptions
{?item wdt:P279 wd:Q30064715 }
union
{?item wdt:P279 wd:Q110620461 }
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?class"):::projected
v1("?item"):::projected
c9(["bd:serviceParam"]):::iri
c5(["wd:Q29918328"]):::iri
c11(["fr,en"]):::literal
c2(["wd:Q30064715"]):::iri
c3(["wd:Q110620461"]):::iri
c7(["wd:Q29918335"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
subgraph unione00[" Union "]
subgraph unione00l[" "]
style unione00l fill:#abf,stroke-dasharray: 3 3;
e0v1 --"wdt:P279"--> e0c3
end
subgraph unione00r[" "]
style unione00r fill:#abf,stroke-dasharray: 3 3;
e0v1 --"wdt:P279"--> e0c2
end
unione00r <== or ==> unione00l
end
e0v1("?item"):::projected
e0c2(["wd:Q30064715"]):::iri
e0c3(["wd:Q110620461"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> c2
f0 --> c3
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P279"--> c3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P279"--> c2
end
union0r <== or ==> union0l
end
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P31"--> c7
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:wdt:P31"--> c5
end
union1r <== or ==> union1l
end
v1 --"wdt:P279"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end