query-37009c9201f7acbc2d9ec7883a05d3d2

rq turtle/ttl

National heroes of Indonesia and their ages (rough approximation based on years) SELECT ?itemID ?labelID (YEAR(?deathdate)-YEAR(?birthdate) AS ?age) WHERE { ?itemID wdt:P166 wd:Q1369309 . # items with award received National Hero of Indonesia ?itemID wdt:P569 ?birthdate . # birthdate information ?itemID wdt:P570 ?deathdate . # deathdate information OPTIONAL { ?itemID rdfs:label ?labelID . # Indonesian label FILTER(LANG(?labelID)="id") } }

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
# National heroes of Indonesia and their ages (rough approximation based on years)
SELECT ?itemID ?labelID (YEAR(?deathdate)-YEAR(?birthdate) AS ?age)
WHERE {
  ?itemID wdt:P166 wd:Q1369309 . # items with award received National Hero of Indonesia
  ?itemID wdt:P569 ?birthdate . # birthdate information
  ?itemID wdt:P570 ?deathdate . # deathdate information
  OPTIONAL { ?itemID rdfs:label ?labelID . # Indonesian label
             FILTER(LANG(?labelID)="id") }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?age") v3("?birthdate"):::projected v4("?deathdate"):::projected v2("?itemID"):::projected v1("?labelID"):::projected c3(["wd:Q1369309"]):::iri v2 --"wdt:P166"--> c3 v2 --"wdt:P569"--> v3 v2 --"wdt:P570"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."rdfs:label".-> v1 end bind0[/"year-from-dateTime(?deathdate) - year-from-dateTime(?birthdate)"/] v4 --o bind0 v3 --o bind0 bind0 --as--o v5