query-f5108014109bec741ca616d523b5e277
Complementary spouses have a complementary spouse statement, although with qualifiers and jazz. What's going on here? doesMade a statement to find spouses that do not have a complementary spouse statement. It works for the most part, but I'm puzzled why it lists spouses that PS. I already added the missing spouse statements, meaning this query is supposed to return no items now.
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#>
SELECT DISTINCT ?item ?itemLabel ?spouse ?spouseLabel
WHERE {
?item wdt:P31 wd:Q5;
wdt:P27 wd:Q20;
wdt:P26 ?spouse.
MINUS { ?spouse wdt:P26 ?item }
FILTER(!wikibase:isSomeValue(?spouse))
SERVICE wikibase:label { bd:serviceParam wikibase:language "nb,en". }
}
ORDER BY (?item)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v2("?spouse"):::projected
c7(["bd:serviceParam"]):::iri
c2(["wd:Q5"]):::iri
c4(["wd:Q20"]):::iri
c9(["nb,en"]):::literal
f0[["not http://wikiba.se/ontology#isSomeValue(?spouse)"]]
f0 --> v2
v1 --"wdt:P31"--> c2
v1 --"wdt:P27"--> c4
v1 --"wdt:P26"--> v2
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v2 --"wdt:P26"--> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end