query-1a34e7fc284e221afd868260309f92b4

rq turtle/ttl

TODO:

* order by creation rather than QID string: "FILTER(STR(?item) < STR(?item2))"

* include non-en labels for first item (times out)

SELECT DISTINCT ?itemName ?item ?dob1displayStr ?dod1displayStr ?item2 ?dob2displayStr ?dod2displayStr ?dobdiff ?doddiff ?meandiff WHERE { ?item (wdt:P106/wdt:P279) wd:Q73145133. # chess people or any subclass thereof { ?item rdfs:label ?itemName. } UNION { ?item skos:altLabel ?itemName. } FILTER((LANG(?itemName)) = "en") ?item2 (wdt:P106/wdt:P279) wd:Q73145133. { ?item2 rdfs:label ?itemName. } UNION { ?item2 skos:altLabel ?itemName. } FILTER((STR(?item)) < (STR(?item2))) MINUS { ?item wdt:P1889 ?item2. } MINUS { ?item2 wdt:P1889 ?item. } MINUS { ?item wdt:P460 ?item2. } MINUS { ?item2 wdt:P460 ?item. } MINUS { ?item wdt:P3373 ?item2. } MINUS { ?item2 wdt:P3373 ?item. }

OPTIONAL { ?item p:P569/psv:P569 [ wikibase:timeValue ?dob1Val; wikibase:timePrecision ?dob1Prec ] . BIND(STR(?dob1Val) AS ?dob1fullStr) BIND(IF(?dob1Prec <= 10, 3, 0) AS ?dob1insigDayChars) BIND(IF(?dob1Prec <= 9, 3, 0) AS ?dob1insigMonthChars) BIND(IF(?dob1Prec <= 8, 9-?dob1Prec, 0) AS ?dob1insigYearChars) BIND(?dob1insigDayChars + ?dob1insigMonthChars + ?dob1insigYearChars AS ?dob1insigDateChars) BIND(SUBSTR(?dob1fullStr, 1, STRLEN(?dob1fullStr) - 10 - ?dob1insigDateChars) AS ?dob1significantStr) BIND(CONCAT(?dob1significantStr, SUBSTR("0000000000000000", 1, ?dob1insigYearChars)) AS ?dob1displayStr) }

OPTIONAL { ?item2 p:P569/psv:P569 [ wikibase:timeValue ?dob2Val; wikibase:timePrecision ?dob2Prec ] . BIND(STR(?dob2Val) AS ?dob2fullStr) BIND(IF(?dob2Prec <= 10, 3, 0) AS ?dob2insigDayChars) BIND(IF(?dob2Prec <= 9, 3, 0) AS ?dob2insigMonthChars) BIND(IF(?dob2Prec <= 8, 9-?dob2Prec, 0) AS ?dob2insigYearChars) BIND(?dob2insigDayChars + ?dob2insigMonthChars + ?dob2insigYearChars AS ?dob2insigDateChars) BIND(SUBSTR(?dob2fullStr, 1, STRLEN(?dob2fullStr) - 10 - ?dob2insigDateChars) AS ?dob2significantStr) BIND(CONCAT(?dob2significantStr, SUBSTR("0000000000000000", 1, ?dob2insigYearChars)) AS ?dob2displayStr) }

BIND(IF(?dob1insigDateChars > ?dob2insigDateChars, ?dob1insigDateChars, ?dob2insigDateChars) AS ?dobCommonInsigDateChars) BIND(SUBSTR(?dob1fullStr, 1, STRLEN(?dob1fullStr) - 10 - ?dobCommonInsigDateChars) AS ?dob1CommonSignificantStr) BIND(SUBSTR(?dob2fullStr, 1, STRLEN(?dob2fullStr) - 10 - ?dobCommonInsigDateChars) AS ?dob2CommonSignificantStr) BIND(STRDT(CONCAT(?dob1CommonSignificantStr, SUBSTR("0000000000000000-01-01T00:00:00Z", 23 - ?dobCommonInsigDateChars)), xsd:dateTime) AS ?dob1CommonSignificant) BIND(STRDT(CONCAT(?dob2CommonSignificantStr, SUBSTR("0000000000000000-01-01T00:00:00Z", 23 - ?dobCommonInsigDateChars)), xsd:dateTime) AS ?dob2CommonSignificant) BIND((CEIL(ABS((?dob1CommonSignificant - ?dob2CommonSignificant) / 3.652425))) / 100 AS ?dobdiff)

OPTIONAL { ?item p:P570/psv:P570 [ wikibase:timeValue ?dod1Val; wikibase:timePrecision ?dod1Prec ] . BIND(STR(?dod1Val) AS ?dod1fullStr) BIND(IF(?dod1Prec <= 10, 3, 0) AS ?dod1insigDayChars) BIND(IF(?dod1Prec <= 9, 3, 0) AS ?dod1insigMonthChars) BIND(IF(?dod1Prec <= 8, 9-?dod1Prec, 0) AS ?dod1insigYearChars) BIND(?dod1insigDayChars + ?dod1insigMonthChars + ?dod1insigYearChars AS ?dod1insigDateChars) BIND(SUBSTR(?dod1fullStr, 1, STRLEN(?dod1fullStr) - 10 - ?dod1insigDateChars) AS ?dod1significantStr) BIND(CONCAT(?dod1significantStr, SUBSTR("0000000000000000", 1, ?dod1insigYearChars)) AS ?dod1displayStr) }

OPTIONAL { ?item2 p:P570/psv:P570 [ wikibase:timeValue ?dod2Val; wikibase:timePrecision ?dod2Prec ] . BIND(STR(?dod2Val) AS ?dod2fullStr) BIND(IF(?dod2Prec <= 10, 3, 0) AS ?dod2insigDayChars) BIND(IF(?dod2Prec <= 9, 3, 0) AS ?dod2insigMonthChars) BIND(IF(?dod2Prec <= 8, 9-?dod2Prec, 0) AS ?dod2insigYearChars) BIND(?dod2insigDayChars + ?dod2insigMonthChars + ?dod2insigYearChars AS ?dod2insigDateChars) BIND(SUBSTR(?dod2fullStr, 1, STRLEN(?dod2fullStr) - 10 - ?dod2insigDateChars) AS ?dod2significantStr) BIND(CONCAT(?dod2significantStr, SUBSTR("0000000000000000", 1, ?dod2insigYearChars)) AS ?dod2displayStr) }

BIND(IF(?dod1insigDateChars > ?dod2insigDateChars, ?dod1insigDateChars, ?dod2insigDateChars) AS ?dodCommonInsigDateChars) BIND(SUBSTR(?dod1fullStr, 1, STRLEN(?dod1fullStr) - 10 - ?dodCommonInsigDateChars) AS ?dod1CommonSignificantStr) BIND(SUBSTR(?dod2fullStr, 1, STRLEN(?dod2fullStr) - 10 - ?dodCommonInsigDateChars) AS ?dod2CommonSignificantStr) BIND(STRDT(CONCAT(?dod1CommonSignificantStr, SUBSTR("0000000000000000-01-01T00:00:00Z", 23 - ?dodCommonInsigDateChars)), xsd:dateTime) AS ?dod1CommonSignificant) BIND(STRDT(CONCAT(?dod2CommonSignificantStr, SUBSTR("0000000000000000-01-01T00:00:00Z", 23 - ?dodCommonInsigDateChars)), xsd:dateTime) AS ?dod2CommonSignificant) BIND((CEIL(ABS((?dod1CommonSignificant - ?dod2CommonSignificant) / 3.652425))) / 100 AS ?doddiff)

BIND(BOUND(?dobdiff) AS ?dobdiffbound) BIND(BOUND(?doddiff) AS ?doddiffbound)

BIND(IF(BOUND(?dobdiff), ?dobdiff, 0) AS ?dobdiffsafe) BIND(IF(BOUND(?doddiff), ?doddiff, 0) AS ?doddiffsafe) BIND((CEIL((?dobdiffsafe + ?doddiffsafe) / (xsd:integer(?dobdiffbound) + xsd:integer(?doddiffbound)) * 100) / 100) AS ?meandiff) } ORDER BY (!(?dobdiffbound) && !(?doddiffbound)) ?meandiff (!(?dobdiffbound)) ?dobdiff (!(?doddiffbound)) ?doddiff ?item LIMIT 500

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 wd: <http://www.wikidata.org/entity/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
# TODO:
# * order by creation rather than QID string: "FILTER(STR(?item) < STR(?item2))"
# * include non-en labels for first item (times out)
SELECT DISTINCT ?itemName ?item ?dob1displayStr ?dod1displayStr ?item2 ?dob2displayStr ?dod2displayStr ?dobdiff ?doddiff ?meandiff WHERE {
  ?item (wdt:P106/wdt:P279*) wd:Q73145133. # chess people or any subclass thereof
  { ?item rdfs:label ?itemName. } UNION { ?item skos:altLabel ?itemName. }
  FILTER((LANG(?itemName)) = "en")
  ?item2 (wdt:P106/wdt:P279*) wd:Q73145133.
  { ?item2 rdfs:label ?itemName. } UNION { ?item2 skos:altLabel ?itemName. }
  FILTER((STR(?item)) < (STR(?item2)))
  MINUS { ?item wdt:P1889 ?item2. }
  MINUS { ?item2 wdt:P1889 ?item. }
  MINUS { ?item wdt:P460 ?item2. }
  MINUS { ?item2 wdt:P460 ?item. }
  MINUS { ?item wdt:P3373 ?item2. }
  MINUS { ?item2 wdt:P3373 ?item. }

  OPTIONAL {
    ?item p:P569/psv:P569 [
      wikibase:timeValue ?dob1Val;
      wikibase:timePrecision ?dob1Prec ] .
    BIND(STR(?dob1Val) AS ?dob1fullStr)
    BIND(IF(?dob1Prec <= 10, 3, 0) AS ?dob1insigDayChars)
    BIND(IF(?dob1Prec <= 9, 3, 0) AS ?dob1insigMonthChars)
    BIND(IF(?dob1Prec <= 8, 9-?dob1Prec, 0) AS ?dob1insigYearChars)
    BIND(?dob1insigDayChars + ?dob1insigMonthChars + ?dob1insigYearChars AS ?dob1insigDateChars)
    BIND(SUBSTR(?dob1fullStr, 1, STRLEN(?dob1fullStr) - 10 - ?dob1insigDateChars) AS ?dob1significantStr)
    BIND(CONCAT(?dob1significantStr, SUBSTR("0000000000000000", 1, ?dob1insigYearChars)) AS ?dob1displayStr)
    }

  OPTIONAL {
    ?item2 p:P569/psv:P569 [
      wikibase:timeValue ?dob2Val;
      wikibase:timePrecision ?dob2Prec ] .
    BIND(STR(?dob2Val) AS ?dob2fullStr)
    BIND(IF(?dob2Prec <= 10, 3, 0) AS ?dob2insigDayChars)
    BIND(IF(?dob2Prec <= 9, 3, 0) AS ?dob2insigMonthChars)
    BIND(IF(?dob2Prec <= 8, 9-?dob2Prec, 0) AS ?dob2insigYearChars)
    BIND(?dob2insigDayChars + ?dob2insigMonthChars + ?dob2insigYearChars AS ?dob2insigDateChars)
    BIND(SUBSTR(?dob2fullStr, 1, STRLEN(?dob2fullStr) - 10 - ?dob2insigDateChars) AS ?dob2significantStr)
    BIND(CONCAT(?dob2significantStr, SUBSTR("0000000000000000", 1, ?dob2insigYearChars)) AS ?dob2displayStr)
    }

  BIND(IF(?dob1insigDateChars > ?dob2insigDateChars, ?dob1insigDateChars, ?dob2insigDateChars) AS ?dobCommonInsigDateChars)
  BIND(SUBSTR(?dob1fullStr, 1, STRLEN(?dob1fullStr) - 10 - ?dobCommonInsigDateChars) AS ?dob1CommonSignificantStr)
  BIND(SUBSTR(?dob2fullStr, 1, STRLEN(?dob2fullStr) - 10 - ?dobCommonInsigDateChars) AS ?dob2CommonSignificantStr)
  BIND(STRDT(CONCAT(?dob1CommonSignificantStr, SUBSTR("0000000000000000-01-01T00:00:00Z", 23 - ?dobCommonInsigDateChars)), xsd:dateTime) AS ?dob1CommonSignificant)
  BIND(STRDT(CONCAT(?dob2CommonSignificantStr, SUBSTR("0000000000000000-01-01T00:00:00Z", 23 - ?dobCommonInsigDateChars)), xsd:dateTime) AS ?dob2CommonSignificant)
  BIND((CEIL(ABS((?dob1CommonSignificant - ?dob2CommonSignificant) / 3.652425))) / 100 AS ?dobdiff)


  OPTIONAL {
    ?item p:P570/psv:P570 [
      wikibase:timeValue ?dod1Val;
      wikibase:timePrecision ?dod1Prec ] .
    BIND(STR(?dod1Val) AS ?dod1fullStr)
    BIND(IF(?dod1Prec <= 10, 3, 0) AS ?dod1insigDayChars)
    BIND(IF(?dod1Prec <= 9, 3, 0) AS ?dod1insigMonthChars)
    BIND(IF(?dod1Prec <= 8, 9-?dod1Prec, 0) AS ?dod1insigYearChars)
    BIND(?dod1insigDayChars + ?dod1insigMonthChars + ?dod1insigYearChars AS ?dod1insigDateChars)
    BIND(SUBSTR(?dod1fullStr, 1, STRLEN(?dod1fullStr) - 10 - ?dod1insigDateChars) AS ?dod1significantStr)
    BIND(CONCAT(?dod1significantStr, SUBSTR("0000000000000000", 1, ?dod1insigYearChars)) AS ?dod1displayStr)
    }

  OPTIONAL {
    ?item2 p:P570/psv:P570 [
      wikibase:timeValue ?dod2Val;
      wikibase:timePrecision ?dod2Prec ] .
    BIND(STR(?dod2Val) AS ?dod2fullStr)
    BIND(IF(?dod2Prec <= 10, 3, 0) AS ?dod2insigDayChars)
    BIND(IF(?dod2Prec <= 9, 3, 0) AS ?dod2insigMonthChars)
    BIND(IF(?dod2Prec <= 8, 9-?dod2Prec, 0) AS ?dod2insigYearChars)
    BIND(?dod2insigDayChars + ?dod2insigMonthChars + ?dod2insigYearChars AS ?dod2insigDateChars)
    BIND(SUBSTR(?dod2fullStr, 1, STRLEN(?dod2fullStr) - 10 - ?dod2insigDateChars) AS ?dod2significantStr)
    BIND(CONCAT(?dod2significantStr, SUBSTR("0000000000000000", 1, ?dod2insigYearChars)) AS ?dod2displayStr)
    }

  BIND(IF(?dod1insigDateChars > ?dod2insigDateChars, ?dod1insigDateChars, ?dod2insigDateChars) AS ?dodCommonInsigDateChars)
  BIND(SUBSTR(?dod1fullStr, 1, STRLEN(?dod1fullStr) - 10 - ?dodCommonInsigDateChars) AS ?dod1CommonSignificantStr)
  BIND(SUBSTR(?dod2fullStr, 1, STRLEN(?dod2fullStr) - 10 - ?dodCommonInsigDateChars) AS ?dod2CommonSignificantStr)
  BIND(STRDT(CONCAT(?dod1CommonSignificantStr, SUBSTR("0000000000000000-01-01T00:00:00Z", 23 - ?dodCommonInsigDateChars)), xsd:dateTime) AS ?dod1CommonSignificant)
  BIND(STRDT(CONCAT(?dod2CommonSignificantStr, SUBSTR("0000000000000000-01-01T00:00:00Z", 23 - ?dodCommonInsigDateChars)), xsd:dateTime) AS ?dod2CommonSignificant)
  BIND((CEIL(ABS((?dod1CommonSignificant - ?dod2CommonSignificant) / 3.652425))) / 100 AS ?doddiff)

  BIND(BOUND(?dobdiff) AS ?dobdiffbound)
  BIND(BOUND(?doddiff) AS ?doddiffbound)

  BIND(IF(BOUND(?dobdiff), ?dobdiff, 0) AS ?dobdiffsafe)
  BIND(IF(BOUND(?doddiff), ?doddiff, 0) AS ?doddiffsafe)
  BIND((CEIL((?dobdiffsafe + ?doddiffsafe) / (xsd:integer(?dobdiffbound) + xsd:integer(?doddiffbound)) * 100) / 100) AS ?meandiff)
}
ORDER BY (!(?dobdiffbound) && !(?doddiffbound)) ?meandiff (!(?dobdiffbound)) ?dobdiff (!(?doddiffbound)) ?doddiff ?item
LIMIT 500

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v30("?dob1CommonSignificant") v28("?dob1CommonSignificantStr") v10("?dob1Prec") v9("?dob1Val") v17("?dob1displayStr"):::projected v11("?dob1fullStr") v15("?dob1insigDateChars") v12("?dob1insigDayChars") v13("?dob1insigMonthChars") v14("?dob1insigYearChars") v16("?dob1significantStr") v31("?dob2CommonSignificant") v29("?dob2CommonSignificantStr") v19("?dob2Prec") v18("?dob2Val") v26("?dob2displayStr"):::projected v20("?dob2fullStr") v24("?dob2insigDateChars") v21("?dob2insigDayChars") v22("?dob2insigMonthChars") v23("?dob2insigYearChars") v25("?dob2significantStr") v27("?dobCommonInsigDateChars") v32("?dobdiff"):::projected v55("?dobdiffbound") v55("?dobdiffsafe") v53("?dod1CommonSignificant") v51("?dod1CommonSignificantStr") v33("?dod1Prec") v32("?dod1Val") v40("?dod1displayStr"):::projected v34("?dod1fullStr") v38("?dod1insigDateChars") v35("?dod1insigDayChars") v36("?dod1insigMonthChars") v37("?dod1insigYearChars") v39("?dod1significantStr") v54("?dod2CommonSignificant") v52("?dod2CommonSignificantStr") v42("?dod2Prec") v41("?dod2Val") v49("?dod2displayStr"):::projected v43("?dod2fullStr") v47("?dod2insigDateChars") v44("?dod2insigDayChars") v45("?dod2insigMonthChars") v46("?dod2insigYearChars") v48("?dod2significantStr") v50("?dodCommonInsigDateChars") v55("?doddiff"):::projected v55("?doddiffbound") v56("?doddiffsafe") v6("?item"):::projected v7("?item2"):::projected v8("?itemName"):::projected v57("?meandiff"):::projected a1((" ")) a2((" ")) a4((" ")) a3((" ")) a6((" ")) a5((" ")) a8((" ")) a7((" ")) a10((" ")) a9((" ")) c4(["wd:Q73145133"]):::iri f0[["str(?item) < str(?item2)"]] f0 --> v6 f0 --> v7 f1[["?itemName = 'en'"]] f1 --> v8 v6 --"p:direct/P106"--> a1 a1 --"p:direct/P279"--> c4 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v6 --"skos:altLabel"--> v8 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v6 --"rdfs:label"--> v8 end union0r <== or ==> union0l end v7 --"p:direct/P106"--> a2 a2 --"p:direct/P279"--> c4 subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v7 --"skos:altLabel"--> v8 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v7 --"rdfs:label"--> v8 end union1r <== or ==> union1l end subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v6 --"p:direct/P1889"--> v7 end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v7 --"p:direct/P1889"--> v6 end subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v6 --"p:direct/P460"--> v7 end subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v7 --"p:direct/P460"--> v6 end subgraph minus6["MINUS"] style minus6 stroke-width:6px,fill:pink,stroke:red; v6 --"p:direct/P3373"--> v7 end subgraph minus7["MINUS"] style minus7 stroke-width:6px,fill:pink,stroke:red; v7 --"p:direct/P3373"--> v6 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; a3 -."wikibase:timeValue".-> v9 a3 --"wikibase:timePrecision"--> v10 v6 --"p:P569"--> a4 a4 --"p:statement/value/P569"--> a3 bind8[/"str(?dob1Val)"/] v9 --o bind8 bind8 --as--o v11 bind9[/"if(?dob1Prec <= '10^^xsd:integer','3^^xsd:integer','0^^xsd:integer')"/] v10 --o bind9 bind9 --as--o v12 bind10[/"if(?dob1Prec <= '9^^xsd:integer','3^^xsd:integer','0^^xsd:integer')"/] v10 --o bind10 bind10 --as--o v13 bind11[/"if(?dob1Prec <= '8^^xsd:integer','9^^xsd:integer' - ?dob1Prec,'0^^xsd:integer')"/] v10 --o bind11 bind11 --as--o v14 bind12[/"?dob1insigDayChars + ?dob1insigMonthChars + ?dob1insigYearChars"/] v12 --o bind12 v13 --o bind12 v14 --o bind12 bind12 --as--o v15 bind13[/"substring(?dob1fullStr,'1^^xsd:integer',string-length(?dob1fullStr) - '10^^xsd:integer' - ?dob1insigDateChars)"/] v11 --o bind13 v15 --o bind13 bind13 --as--o v16 bind14[/"concat(?dob1significantStr,substring('0000000000000000','1^^xsd:integer',?dob1insigYearChars))"/] v16 --o bind14 v14 --o bind14 bind14 --as--o v17 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; a5 -."wikibase:timeValue".-> v18 a5 --"wikibase:timePrecision"--> v19 v7 --"p:P569"--> a6 a6 --"p:statement/value/P569"--> a5 bind15[/"str(?dob2Val)"/] v18 --o bind15 bind15 --as--o v20 bind16[/"if(?dob2Prec <= '10^^xsd:integer','3^^xsd:integer','0^^xsd:integer')"/] v19 --o bind16 bind16 --as--o v21 bind17[/"if(?dob2Prec <= '9^^xsd:integer','3^^xsd:integer','0^^xsd:integer')"/] v19 --o bind17 bind17 --as--o v22 bind18[/"if(?dob2Prec <= '8^^xsd:integer','9^^xsd:integer' - ?dob2Prec,'0^^xsd:integer')"/] v19 --o bind18 bind18 --as--o v23 bind19[/"?dob2insigDayChars + ?dob2insigMonthChars + ?dob2insigYearChars"/] v21 --o bind19 v22 --o bind19 v23 --o bind19 bind19 --as--o v24 bind20[/"substring(?dob2fullStr,'1^^xsd:integer',string-length(?dob2fullStr) - '10^^xsd:integer' - ?dob2insigDateChars)"/] v20 --o bind20 v24 --o bind20 bind20 --as--o v25 bind21[/"concat(?dob2significantStr,substring('0000000000000000','1^^xsd:integer',?dob2insigYearChars))"/] v25 --o bind21 v23 --o bind21 bind21 --as--o v26 end bind22[/"if(?dob1insigDateChars > ?dob2insigDateChars,?dob1insigDateChars,?dob2insigDateChars)"/] v15 --o bind22 v24 --o bind22 bind22 --as--o v27 bind23[/"substring(?dob1fullStr,'1^^xsd:integer',string-length(?dob1fullStr) - '10^^xsd:integer' - ?dobCommonInsigDateChars)"/] v11 --o bind23 v27 --o bind23 bind23 --as--o v28 bind24[/"substring(?dob2fullStr,'1^^xsd:integer',string-length(?dob2fullStr) - '10^^xsd:integer' - ?dobCommonInsigDateChars)"/] v20 --o bind24 v27 --o bind24 bind24 --as--o v29 bind25[/"STRDT(concat(?dob1CommonSignificantStr,substring('0000000000000000-01-01T00:00:00Z','23^^xsd:integer' - ?dobCommonInsigDateChars)),'xsd:dateTime')"/] v28 --o bind25 v27 --o bind25 bind25 --as--o v30 bind26[/"STRDT(concat(?dob2CommonSignificantStr,substring('0000000000000000-01-01T00:00:00Z','23^^xsd:integer' - ?dobCommonInsigDateChars)),'xsd:dateTime')"/] v29 --o bind26 v27 --o bind26 bind26 --as--o v31 bind27[/"numeric-ceil(numeric-abs(?dob1CommonSignificant - ?dob2CommonSignificant / '3.652425^^xsd:decimal')) / '100^^xsd:integer'"/] v30 --o bind27 v31 --o bind27 bind27 --as--o v32 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; a7 -."wikibase:timeValue".-> v32 a7 --"wikibase:timePrecision"--> v33 v6 --"p:P570"--> a8 a8 --"p:statement/value/P570"--> a7 bind28[/"str(?dod1Val)"/] v32 --o bind28 bind28 --as--o v34 bind29[/"if(?dod1Prec <= '10^^xsd:integer','3^^xsd:integer','0^^xsd:integer')"/] v33 --o bind29 bind29 --as--o v35 bind30[/"if(?dod1Prec <= '9^^xsd:integer','3^^xsd:integer','0^^xsd:integer')"/] v33 --o bind30 bind30 --as--o v36 bind31[/"if(?dod1Prec <= '8^^xsd:integer','9^^xsd:integer' - ?dod1Prec,'0^^xsd:integer')"/] v33 --o bind31 bind31 --as--o v37 bind32[/"?dod1insigDayChars + ?dod1insigMonthChars + ?dod1insigYearChars"/] v35 --o bind32 v36 --o bind32 v37 --o bind32 bind32 --as--o v38 bind33[/"substring(?dod1fullStr,'1^^xsd:integer',string-length(?dod1fullStr) - '10^^xsd:integer' - ?dod1insigDateChars)"/] v34 --o bind33 v38 --o bind33 bind33 --as--o v39 bind34[/"concat(?dod1significantStr,substring('0000000000000000','1^^xsd:integer',?dod1insigYearChars))"/] v39 --o bind34 v37 --o bind34 bind34 --as--o v40 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; a9 -."wikibase:timeValue".-> v41 a9 --"wikibase:timePrecision"--> v42 v7 --"p:P570"--> a10 a10 --"p:statement/value/P570"--> a9 bind35[/"str(?dod2Val)"/] v41 --o bind35 bind35 --as--o v43 bind36[/"if(?dod2Prec <= '10^^xsd:integer','3^^xsd:integer','0^^xsd:integer')"/] v42 --o bind36 bind36 --as--o v44 bind37[/"if(?dod2Prec <= '9^^xsd:integer','3^^xsd:integer','0^^xsd:integer')"/] v42 --o bind37 bind37 --as--o v45 bind38[/"if(?dod2Prec <= '8^^xsd:integer','9^^xsd:integer' - ?dod2Prec,'0^^xsd:integer')"/] v42 --o bind38 bind38 --as--o v46 bind39[/"?dod2insigDayChars + ?dod2insigMonthChars + ?dod2insigYearChars"/] v44 --o bind39 v45 --o bind39 v46 --o bind39 bind39 --as--o v47 bind40[/"substring(?dod2fullStr,'1^^xsd:integer',string-length(?dod2fullStr) - '10^^xsd:integer' - ?dod2insigDateChars)"/] v43 --o bind40 v47 --o bind40 bind40 --as--o v48 bind41[/"concat(?dod2significantStr,substring('0000000000000000','1^^xsd:integer',?dod2insigYearChars))"/] v48 --o bind41 v46 --o bind41 bind41 --as--o v49 end bind42[/"if(?dod1insigDateChars > ?dod2insigDateChars,?dod1insigDateChars,?dod2insigDateChars)"/] v38 --o bind42 v47 --o bind42 bind42 --as--o v50 bind43[/"substring(?dod1fullStr,'1^^xsd:integer',string-length(?dod1fullStr) - '10^^xsd:integer' - ?dodCommonInsigDateChars)"/] v34 --o bind43 v50 --o bind43 bind43 --as--o v51 bind44[/"substring(?dod2fullStr,'1^^xsd:integer',string-length(?dod2fullStr) - '10^^xsd:integer' - ?dodCommonInsigDateChars)"/] v43 --o bind44 v50 --o bind44 bind44 --as--o v52 bind45[/"STRDT(concat(?dod1CommonSignificantStr,substring('0000000000000000-01-01T00:00:00Z','23^^xsd:integer' - ?dodCommonInsigDateChars)),'xsd:dateTime')"/] v51 --o bind45 v50 --o bind45 bind45 --as--o v53 bind46[/"STRDT(concat(?dod2CommonSignificantStr,substring('0000000000000000-01-01T00:00:00Z','23^^xsd:integer' - ?dodCommonInsigDateChars)),'xsd:dateTime')"/] v52 --o bind46 v50 --o bind46 bind46 --as--o v54 bind47[/"numeric-ceil(numeric-abs(?dod1CommonSignificant - ?dod2CommonSignificant / '3.652425^^xsd:decimal')) / '100^^xsd:integer'"/] v53 --o bind47 v54 --o bind47 bind47 --as--o v55 bind48[/"bound(?dobdiff)"/] v32 --o bind48 bind48 --as--o v55 bind49[/"bound(?doddiff)"/] v55 --o bind49 bind49 --as--o v55 bind50[/"if(bound(?dobdiff),?dobdiff,'0^^xsd:integer')"/] v32 --o bind50 bind50 --as--o v55 bind51[/"if(bound(?doddiff),?doddiff,'0^^xsd:integer')"/] v55 --o bind51 bind51 --as--o v56 bind52[/"numeric-ceil(?dobdiffsafe + ?doddiffsafe / http://www.w3.org/2001/XMLSchema#integer(?dobdiffbound) + http://www.w3.org/2001/XMLSchema#integer(?doddiffbound) * '100^^xsd:integer') / '100^^xsd:integer'"/] v55 --o bind52 v56 --o bind52 v55 --o bind52 v55 --o bind52 bind52 --as--o v57