query-953d0b3dc1c72719b24da4cfef083ea2

rq turtle/ttl

Propertiesspouse (P26)date of birth (P569)date of death (P570)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT DISTINCT ?item 
{ 
    {
        SELECT ?item WHERE { 
        ?item wdt:P26 ?item2
              ; p:P569/psv:P569 [ wikibase:timeValue ?birth1 ; wikibase:timePrecision "11"^^xsd:integer ] . 
        ?item2 p:P570/psv:P570 [ wikibase:timeValue ?death2 ; wikibase:timePrecision "11"^^xsd:integer ] . 
        FILTER (?birth1 > ?death2) } 
    } 
    UNION 
    { 
        SELECT ?item WHERE { 
        ?item wdt:P26 ?item2
          ; p:P570/psv:P570 [ wikibase:timeValue ?death1 ; wikibase:timePrecision "11"^^xsd:integer ] .
        ?item2 p:P569/psv:P569 [ wikibase:timeValue ?birth2 ; wikibase:timePrecision "11"^^xsd:integer ] .
        FILTER (?birth2 > ?death1) } 
    }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?birth1") v5("?birth2") v6("?death1") v2("?death2") v3("?item"):::projected v4("?item2") a2((" ")) a1((" ")) a4((" ")) a3((" ")) a6((" ")) a5((" ")) a8((" ")) a7((" ")) c4(["11^^xsd:integer"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["?birth2 > ?death1"]] f0 --> v5 f0 --> v6 v3 --"p:direct/P26"--> v4 a5 --"wikibase:timeValue"--> v6 a5 --"wikibase:timePrecision"--> c4 v3 --"p:P570"--> a6 a6 --"p:statement/value/P570"--> a5 a7 --"wikibase:timeValue"--> v5 a7 --"wikibase:timePrecision"--> c4 v4 --"p:P569"--> a8 a8 --"p:statement/value/P569"--> a7 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f1[["?birth1 > ?death2"]] f1 --> v1 f1 --> v2 v3 --"p:direct/P26"--> v4 a1 --"wikibase:timeValue"--> v1 a1 --"wikibase:timePrecision"--> c4 v3 --"p:P569"--> a2 a2 --"p:statement/value/P569"--> a1 a3 --"wikibase:timeValue"--> v2 a3 --"wikibase:timePrecision"--> c4 v4 --"p:P570"--> a4 a4 --"p:statement/value/P570"--> a3 end union0r <== or ==> union0l end