User:Luckyz/StregaAward

From Wikidata
Jump to navigation Jump to search
SELECT
  ?item ?itemLabel 
  (GROUP_CONCAT(DISTINCT ?autoreLabel; separator=", ") as ?autoreLabel_ )
  (MIN(YEAR(?pubblicazione)) as ?pubblicazione_ ) 
  (MIN(YEAR(?data_premio_strega)) as ?data_premio_strega_ ) 
  (GROUP_CONCAT(DISTINCT ?genreLabel; separator=", ") as ?genreLabel_ ) 
  (GROUP_CONCAT(DISTINCT ?casa_editriceLabel; separator=", ") as ?casa_editriceLabel_ ) 
  (GROUP_CONCAT(DISTINCT ?VIAFLabel; separator=", ") as ?VIAF_ ) 

WHERE
{
    BIND( wd:Q731542 as ?tipopremio )
    ?item  wdt:P166 ?tipopremio. MINUS { ?item wdt:P31 wd:Q5 } 
  # ?autore p:P166 ?st . ?st pq:P1686 ?item ; ps:P166 ?tipopremio . ?autore wdt:P31 wd:Q5 .
#alternativa2:  ?item  wdt:P166 ?tipopremio . hint:Prior hint:runFirst true . ?item  wdt:P31/wdt:P279* wd:Q47461344 . 
#alternativa:   ?autore p:P166 ?st . ?st pq:P1686 ?item ; ps:P166 ?tipopremio . ?autore wdt:P31 wd:Q5 .
    OPTIONAL { ?item p:P166 ?premio . ?premio pq:P585 ?data_premio_strega ; ps:P166 ?tipopremio } 
    OPTIONAL { ?item wdt:P577 ?pubblicazione. } 
    OPTIONAL { ?item wdt:P50 ?autore }  #nome dell'autore
    OPTIONAL { ?item wdt:P136 ?genre }  #genere del libro
    OPTIONAL { ?item wdt:P123 ?casa_editrice } #casa editrice
    OPTIONAL { ?item  wdt:P214 ?VIAF } #VIAF
 
    SERVICE wikibase:label { bd:serviceParam wikibase:language "it,[AUTO_LANGUAGE],en" .
                           # necessario per GROUP BY/GROUP_CONCAT: 
                           ?item rdfs:label ?itemLabel .
                           ?autore rdfs:label ?autoreLabel .
                           ?genre rdfs:label ?genreLabel .
                           ?casa_editrice rdfs:label ?casa_editriceLabel . 
                           ?VIAF rdfs:label ?VIAFLabel . 
                           }
}
GROUP BY ?item ?itemLabel 

ORDER BY ?data_premio_strega_
Try it!


SELECT ?item ?itemLabel_en ?sitelink ?itemLabel_it
WHERE 
{
  ?item wdt:P27 wd:Q38 .
  ?item wdt:P21 wd:Q6581072 .
  ?article schema:about ?item ;
           schema:name ?sitelink ;
           schema:isPartOf <https://it.wikipedia.org/> .
  MINUS { ?item wdt:P106 [] } 
}
Try it!