query-3542c955a0d6c2b30e5b0ff662ef9393

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?child1 ?child1Label ?birth1 ?child2 ?child2Label ?birth2
WHERE
{
  # Find 2 siblings
  ?parent wdt:P31 wd:Q5.
  ?parent wdt:P21 wd:Q6581097. # Parent is male, could also have been wd:Q6581072 (female)
  ?parent wdt:P40 ?child1.
  ?parent wdt:P40 ?child2.
  FILTER (?child1 != ?child2)

  ?child1 p:P569 ?birth1_statement.
  ?birth1_statement psv:P569 ?birth1_value.
  ?birth1_value wikibase:timePrecision 11 . # Use values with precision day only.
  ?birth1_value wikibase:timeValue ?birth1. 

  ?child2 p:P569 ?birth2_statement.
  ?birth2_statement psv:P569 ?birth2_value.
  ?birth2_value wikibase:timePrecision 11 . # Use values with precision day only.
  ?birth2_value wikibase:timeValue ?birth2. 

  FILTER (?birth1 < ?birth2 &&              # Eliminate twins born same say and select each sibling pair only once
          ?birth2 - ?birth1 < 365)          # They must be born less than a year apart
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 10

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?birth1"):::projected v6("?birth1_statement") v7("?birth1_value") v2("?birth2"):::projected v8("?birth2_statement") v9("?birth2_value") v3("?child1"):::projected v4("?child2"):::projected v5("?parent") c10(["11^^xsd:integer"]):::literal c5(["wd:Q6581097"]):::iri c13(["bd:serviceParam"]):::iri c3(["wd:Q5"]):::iri c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?birth1 < ?birth2?birth2 - ?birth1 < '365^^xsd:integer'"]] f0 --> v1 f0 --> v2 f1[["?child1 != ?child2"]] f1 --> v3 f1 --> v4 v5 --"p:direct/P31"--> c3 v5 --"p:direct/P21"--> c5 v5 --"p:direct/P40"--> v3 v5 --"p:direct/P40"--> v4 v3 --"p:P569"--> v6 v6 --"p:statement/value/P569"--> v7 v7 --"wikibase:timePrecision"--> c10 v7 --"wikibase:timeValue"--> v1 v4 --"p:P569"--> v8 v8 --"p:statement/value/P569"--> v9 v9 --"wikibase:timePrecision"--> c10 v9 --"wikibase:timeValue"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end