query-648affafe656c55795f8e8dedfbffc21
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT (STRAFTER( STR( ?child1 ), STR( wd: ) ) AS ?1) ('P3373' AS ?P3373) (STRAFTER( STR( ?child2 ), STR( wd: ) ) AS ?2)
('S3452' AS ?S3452_1) (STRAFTER( STR( ?mother ), STR( wd: ) ) AS ?3) ('S3452' AS ?S3452_2) (STRAFTER( STR( ?father ), STR( wd: ) ) AS ?4)
{
?mother ^wdt:P25 ?child1, ?child2; wdt:P31 wd:Q5 .
?father ^wdt:P22 ?child1, ?child2; wdt:P31 wd:Q5 .
FILTER( ?child1 != ?child2 ) .
MINUS { ?child1 wdt:P3373 ?child2 } .
OPTIONAL { ?child1 wdt:P569 ?dob1 } .
OPTIONAL { ?child2 wdt:P569 ?dob2 } .
OPTIONAL { ?child1 wdt:P570 ?dod1 } .
OPTIONAL { ?child2 wdt:P570 ?dod2 } .
FILTER( ( BOUND( ?dob1 ) && BOUND( ?dod2 ) && ?dod2 > ?dod1 )|| ( BOUND( ?dob2 ) && BOUND( ?dod1 ) && ?dod1 > ?dod2 ) ) .
} ORDER BY ?1
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?1")
v11("?2")
v13("?3")
v15("?4")
v10("?P3373")
v12("?S3452_1")
v14("?S3452_2")
v6("?child1"):::projected
v7("?child2"):::projected
v2("?dob1")
v5("?dob2")
v4("?dod1")
v3("?dod2")
v9("?father"):::projected
v8("?mother"):::projected
c3(["wd:Q5"]):::iri
f0[["(bound(?dob1)bound(?dod2)?dod2 > ?dod1 || bound(?dob2)bound(?dod1)?dod1 > ?dod2)"]]
f0 --> v2
f0 --> v3
f0 --> v4
f0 --> v5
f1[["?child1 != ?child2"]]
f1 --> v6
f1 --> v7
v6 --"wdt:P25"--> v8
v7 --"wdt:P25"--> v8
v8 --"wdt:P31"--> c3
v6 --"wdt:P22"--> v9
v7 --"wdt:P22"--> v9
v9 --"wdt:P31"--> c3
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v6 --"wdt:P3373"--> v7
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."wdt:P569".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v7 -."wdt:P569".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v6 -."wdt:P570".-> v4
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v7 -."wdt:P570".-> v3
end
bind3[/"substring-after(str(?child1),str('wd:'))"/]
v6 --o bind3
bind3 --as--o v10
bind4[/"'P3373'"/]
bind4 --as--o v10
bind5[/"substring-after(str(?child2),str('wd:'))"/]
v7 --o bind5
bind5 --as--o v11
bind6[/"'S3452'"/]
bind6 --as--o v12
bind7[/"substring-after(str(?mother),str('wd:'))"/]
v8 --o bind7
bind7 --as--o v13
bind8[/"'S3452'"/]
bind8 --as--o v14
bind9[/"substring-after(str(?father),str('wd:'))"/]
v9 --o bind9
bind9 --as--o v15