query-48c4ee782cf3a9a6b5521d934c2aab9d

rq turtle/ttl

Child older than parent

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?child ?childLabel ?cdob ?parent ?parentLabel ?pdob WHERE {
  ?child wdt:P25 ?parent. # Or P22, or P40 reversed
  ?child wdt:P569 ?cdob.
  ?parent wdt:P569 ?pdob.
  FILTER(YEAR(?cdob)<=YEAR(?pdob) && ! REGEX(STR(YEAR(?cdob)), "[05][01]$") && ! REGEX(STR(YEAR(?pdob)), "[05][01]$")).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?cdob"):::projected v3("?child"):::projected v4("?parent"):::projected v2("?pdob"):::projected c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["year-from-dateTime(?cdob) <= year-from-dateTime(?pdob)not regex(str(year-from-dateTime(?cdob)),'#91;05#93;#91;01#93;$')not regex(str(year-from-dateTime(?pdob)),'#91;05#93;#91;01#93;$')"]] f0 --> v1 f0 --> v2 v3 --"wdt:P25"--> v4 v3 --"wdt:P569"--> v1 v4 --"wdt:P569"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end