query-617a4bdda2390900b8defb4f7f0f18ea
sex or gender (P21)
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT (STRAFTER(STR(?item), STR(wd:)) AS ?1) ('P21' AS ?P21) (STRAFTER(STR(?gender), STR(wd:)) AS ?2) ('S3452' AS ?P3452)
(STRAFTER(STR(?relative), STR(wd:)) AS ?3) {
?relative p:P1038 [ ps:P1038 ?item; pq:P1039 ?relation ] .
MINUS { ?item wdt:P21 [] } .
FILTER( !ISBLANK( ?item ) ) .
?relation wdt:P1552 ?gender .
} ORDER BY ?2
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?1")
v8("?2")
v9("?3")
v7("?P21")
v8("?P3452")
v5("?gender"):::projected
v2("?item"):::projected
v3("?relation")
v4("?relative"):::projected
a2((" "))
a1((" "))
f0[["not isBlank(?item)"]]
f0 --> v2
a1 --"p:statement/P1038"--> v2
a1 --"p:qualifier/P1039"--> v3
v4 --"p:P1038"--> a1
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:direct/P21"--> a2
end
v3 --"p:direct/P1552"--> v5
bind2[/"substring-after(str(?item),str('wd:'))"/]
v2 --o bind2
bind2 --as--o v6
bind3[/"'P21'"/]
bind3 --as--o v7
bind4[/"substring-after(str(?gender),str('wd:'))"/]
v5 --o bind4
bind4 --as--o v8
bind5[/"'S3452'"/]
bind5 --as--o v8
bind6[/"substring-after(str(?relative),str('wd:'))"/]
v4 --o bind6
bind6 --as--o v9