query-caffdabb6ed5c896feb3b105c6774031

rq turtle/ttl

Propertiesinstance of (P31)native language (P103)country of citizenship (P27)date of birth (P569)date of death (P570)award received (P166)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?statements ?linkcount ?itemLabel ?itemDescription ?dob ?dod (GROUP_CONCAT(DISTINCT ?awd_label ;separator=', ') AS ?awards)
WHERE {
  ?item wdt:P31 wd:Q5 .     # item = humans only
   ?item wdt:P103 wd:Q33810 .
  #?item wdt:P27 wd:Q668.

#___BIRTH AND DEATH___
  BIND(NOW() as $today)
  BIND(YEAR($today) AS $today_year)
  BIND(MONTH($today) AS $today_month)
  OPTIONAL { ?item wdt:P569 ?dob }
  OPTIONAL { ?item wdt:P570 ?dod }
  FILTER( $today_month = MONTH(?dob) ||  $today_month = MONTH(?dod) )   
 #___ AWARDS ___
 ?item wdt:P166 ?award .
    ?award rdfs:label ?awd_label 
          FILTER (lang(?awd_label) = "or") . # to get only Odia labels

  ?item wikibase:statements ?statements . # for counting statements
  OPTIONAL { ?item wikibase:sitelinks ?linkcount. }  #count sitelinks
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en".}    # for generating label  
}
GROUP BY ?item ?statements ?linkcount ?itemLabel ?itemDescription ?dob ?dod
ORDER BY DESC (?linkcount)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?award") v11("?awards") v2("?awd_label"):::projected v4("?dob"):::projected v5("?dod"):::projected v6("?item"):::projected v1("?linkcount"):::projected v10("?statements"):::projected v7("?today") v9("?today_month") v8("?today_year") c15(["#91;AUTO_LANGUAGE#93;, en"]):::literal c13(["bd:serviceParam"]):::iri c3(["wd:Q5"]):::iri c5(["wd:Q33810"]):::iri f0[["?awd_label = 'or'"]] f0 --> v2 f1[["(?today_month = month-from-dateTime(?dob) || ?today_month = month-from-dateTime(?dod))"]] f1 --> v9 f1 --> v4 f1 --> v5 v6 --"wdt:P31"--> c3 v6 --"wdt:P103"--> c5 bind2[/"NOW()"/] bind2 --as--o v7 bind3[/"year-from-dateTime(?today)"/] v7 --o bind3 bind3 --as--o v8 bind4[/"month-from-dateTime(?today)"/] v7 --o bind4 bind4 --as--o v9 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P569".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P570".-> v5 end v6 --"wdt:P166"--> v9 v9 --"rdfs:label"--> v2 v6 --"wikibase:statements"--> v10 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."wikibase:sitelinks".-> v1 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end bind6[/"?awd_label"/] v2 --o bind6 bind6 --as--o v11