query-b327a317dbe1386b8ea2ac35ce79d522

rq turtle/ttl

'27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 « Club des 27 » — musiciens morts à 27 ans '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 Il 'club dei 27': i musicisti morti a 27 anni '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - muzikanten die op 27-jarige leeftijd overleden '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 "27-klubben" - musiker som dött vid 27 års ålder '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27 "Клуб 27" - музиканти, які померли у віці 27 років '27 club' - musicians who died at age 27 '27 club' - musicians who died at age 27

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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?person ?personLabel ?dob ?dod (xsd:integer(?age_) as ?age)
where {
  # We do a subquery here, because otherwise we'll get a timeout because of the labels
  {
    SELECT DISTINCT ?person ?dob ?dod ?age_
    where {
      ?person wdt:P31 wd:Q5; # Get all humans
        wdt:P106/wdt:P279* wd:Q639669; # That have a musician or a subclass thereof as their occupation
        p:P569 ?dob_st; # death of birth
        p:P570 ?dod_st. # death of death

      ?dob_st psv:P569 [ wikibase:timeValue ?dob; wikibase:timePrecision ?dob_prec ];
        a wikibase:BestRank.
      ?dod_st psv:P570 [ wikibase:timeValue ?dod; wikibase:timePrecision ?dod_prec ];
        a wikibase:BestRank.

      # Only accept date precisions of a day or better, so it doesn't cause problems when we calculate age
      FILTER(?dob_prec >= 11 && ?dod_prec >= 11)

      # Time differences in Blazegraph are counted as days and is xsd:double
      # We then calculate the age by dividing this by the orbital period of Earth
      # This is a shortcut, but it is accurate enough for our purposes
      bind((?dod - ?dob) / 365.2564 as ?age_)

      # And filter by age
      filter(?age_ >= 27.0 && ?age_ < 28.0)
    }
    #LIMIT 1000
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY desc(?dod) # Order by most recent

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?age") v9("?age_"):::projected v8("?dob"):::projected v3("?dob_prec") v6("?dob_st") v1("?dod"):::projected v4("?dod_prec") v7("?dod_st") v5("?person"):::projected a1((" ")) a2((" ")) a3((" ")) c8(["wd:Q639669"]):::iri c15(["wikibase:BestRank"]):::iri c20(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal c18(["bd:serviceParam"]):::iri c5(["wd:Q5"]):::iri f0[["?age_ >= '27.0^^xsd:decimal'?age_ < '28.0^^xsd:decimal'"]] f0 --> v9 f1[["?dob_prec >= '11^^xsd:integer'?dod_prec >= '11^^xsd:integer'"]] f1 --> v3 f1 --> v4 v5 --"p:direct/P31"--> c5 v5 --"p:direct/P106"--> a1 a1 --"p:direct/P279"--> c8 v5 --"p:P569"--> v6 v5 --"p:P570"--> v7 a2 --"wikibase:timeValue"--> v8 a2 --"wikibase:timePrecision"--> v3 v6 --"p:statement/value/P569"--> a2 v6 --"a"--> c15 a3 --"wikibase:timeValue"--> v1 a3 --"wikibase:timePrecision"--> v4 v7 --"p:statement/value/P570"--> a3 v7 --"a"--> c15 bind2[/"?dod - ?dob / '365.2564^^xsd:decimal'"/] v1 --o bind2 v8 --o bind2 bind2 --as--o v9 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c18 --"wikibase:language"--> c20 end bind3[/"http://www.w3.org/2001/XMLSchema#integer(?age_)"/] v9 --o bind3 bind3 --as--o v9