User:Luca.favorido/Queries

From Wikidata
Jump to navigation Jump to search

General[edit]

Born on a specific date[edit]

#defaultView:ImageGrid
SELECT ?item ?itemLabel ?img WHERE {
  ?item wdt:P569 "+1991-04-19T00:00:00Z"^^xsd:dateTime.
  ?item wdt:P18 ?img
     SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE],en" .
   }
}

Try it!

Pagine wikipedia sull'Italia[edit]

SELECT distinct ?item ?itemLabel ?itemDescription WHERE{  
  ?item ?label "Italia"@en.  
  ?item wdt:P31 wd:Q6256 .
  ?article schema:about ?item .
  ?article schema:inLanguage "it" .
  ?article schema:isPartOf <https://it.wikipedia.org/>.
   SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE],en" .
   } 
}

Try it!

Buried in S. Michele[edit]

SELECT ?Person ?PersonLabel ?Find_A_Grave_memorial_ID WHERE {
  ?Person wdt:P119 wd:Q3676942.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?Person wdt:P535 ?Find_A_Grave_memorial_ID. }
}

Try it!

Padua University Rectors by dates[edit]

SELECT ?rettore ?rettoreLabel ?starttime ?endtime WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?rettore p:P39 [
    ps:P39 wd:Q212071;
    pq:P642 wd:Q193510;
    pq:P580 ?starttime;
    pq:P582 ?endtime
  ].
}
ORDER BY ?starttime

Try it!

People in the consulta nazionale[edit]

SELECT ?persona ?personaLabel ?cognomeLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?persona wdt:P463 wd:Q2995361.
  OPTIONAL { ?persona wdt:P734 ?cognome. }
}
order by ?cognomeLabel

Try it! [1](Consultori Nazionali)

Padua University Rectors images[edit]

#defaultView:ImageGrid
SELECT ?rettore ?pic ?rettoreLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?rettore wdt:P18 ?pic.
  ?rettore p:P106 [
    ps:P106 wd:Q212071;
    pq:P642 wd:Q193510;
  ].
}
ORDER BY ?starttime

Try it!


Padua University Rectors[edit]

SELECT 
  ?rettore
  ?rettoreLabel
  (year(xsd:dateTime(?starttime)) as ?startyear)
  (year(xsd:dateTime(?endtime)) as ?endyear)
WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?rettore p:P39 [
    ps:P39 wd:Q212071;
    pq:P642 wd:Q193510;
    pq:P580 ?starttime;
  ].
  OPTIONAL { ?rettore p:P106 [
    pq:P582 ?endtime
  ] }
}
ORDER BY ?starttime

Try it!


Works depicting Judas[edit]

#defaultView:ImageGrid
# Works depicting Judas
SELECT ?item ?itemLabel ?img
WHERE
{
  ?item wdt:P180 wd:Q81018 .
  ?item wdt:P18 ?img.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,it,fr". }
}

Try it!

Astronomia[edit]

Constellations[edit]

SELECT ?item ?itemLabel 
WHERE 
{
  ?item wdt:P31 wd:Q8928.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!

galaxies in the Boote constellation (labels in english and italian)[edit]

SELECT ?item ?label_en ?itemLabel ?itemDescription
WHERE 
{
  ?item wdt:P31 wd:Q318;
        wdt:P59 wd:Q8667.
        ?item rdfs:label ?label_en 
        filter (lang(?label_en) = "en").
     SERVICE wikibase:label { bd:serviceParam wikibase:language "it". }
}

Try it!

Storia[edit]

Stemmi reggimenti[edit]

SELECT ?item ?itemLabel ?stemma WHERE {
  ?item (wdt:P31/(wdt:P279*)) wd:Q52371;
    wdt:P17 wd:Q38.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it,en,fr,de,es,ru". }
  OPTIONAL { ?item wdt:P94 ?stemma. }
}

Try it!

Spedizione dei mille[edit]

SELECT 
  (?item AS ?id) 
  (?itemLabel AS ?nome) 
  (?data_di_nascita AS ?nato_il) 
  (?luogo_di_nascitaLabel AS ?nato_a) 
  (?data_di_morte AS ?morto_il)  
  (?luogo_di_morteLabel AS ?morto_a) 
WHERE {
  ?item wdt:P607 wd:Q228284.
  OPTIONAL { ?item wdt:P569 ?data_di_nascita. }
  OPTIONAL { ?item wdt:P570 ?data_di_morte. }
  OPTIONAL { ?item wdt:P19 ?luogo_di_nascita. }
  OPTIONAL { ?item wdt:P20 ?luogo_di_morte. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". 
     ?item rdfs:label ?itemLabel.
     ?luogo_di_nascita rdfs:label ?luogo_di_nascitaLabel.
     ?luogo_di_morte rdfs:label ?luogo_di_morteLabel.
  }
}

Try it!

Famous people died because of the Messina Earthquake[edit]

SELECT ?item ?itemLabel WHERE {
  ?item wdt:P509 wd:Q1348910.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!

Geografia[edit]

Organi a canne per stato[edit]

#defaultView:Map{"hide":["?coord","?area_scale_km", "?paese"], "layer": "?paeseLabel"}
SELECT ?item ?itemLabel ?coord ?paese ?paeseLabel WHERE {
  ?item wdt:P625 ?coord;
    wdt:P31 wd:Q281460.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?item wdt:P17 ?paese. }
}

Try it!

SELECT ?item ?label ?istanza_di ?istanza_diLabel
WHERE
{
  SERVICE wikibase:mwapi
  {
    bd:serviceParam wikibase:endpoint "www.wikidata.org";
                    wikibase:api "Generator";
                    mwapi:generator "search";
                    mwapi:gsrsearch "inlabel:Organ";
                    mwapi:gsrlimit "max".
    ?item wikibase:apiOutputItem mwapi:title.
  }
  ?item rdfs:label ?label.
  FILTER CONTAINS(?label, "organ")
  OPTIONAL { ?item wdt:P31 ?istanza_di. }
}

Try it!


SELECT ?item ?itemLabel ?sottoclasse_di ?istanza_di

WITH {
  SELECT DISTINCT ?item

WHERE
{
  SERVICE wikibase:mwapi
  {
    bd:serviceParam wikibase:endpoint "www.wikidata.org";
                    wikibase:api "Generator";
                    mwapi:generator "search";
                    mwapi:gsrsearch "inlabel:orgel";
                    mwapi:gsrlimit "max".
    ?item wikibase:apiOutputItem mwapi:title.
  }
  ?item rdfs:label ?label.
  FILTER CONTAINS(?label, "orgel")
}
} AS %results 

WHERE {
  INCLUDE %results.
  
  OPTIONAL { ?item wdt:P279 ?sottoclasse_di. }
  OPTIONAL { ?item wdt:P31 ?istanza_di. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,it,fr,de". }
}

Try it!


Luoghi "fuori zona"[edit]

#defaultView:Map
SELECT ?item ?coord
WHERE 
{ 
       ?item wdt:P131 ?sub1 . 
       ?sub1 (wdt:P131)* wd:Q1243 .
       ?item wdt:P625 ?coord .
}

Try it!


Scuole a Venezia[edit]

#scuole a venezia
SELECT DISTINCT ?building ?buildingLabel ?schoolLabel ?coord ?address
WHERE
{
  ?building wdt:P131 wd:Q641.
  ?building wdt:P31 ?school.
  ?school wdt:P279* wd:Q3914.
  OPTIONAL {?building wdt:P625 ?coord .}
  OPTIONAL {?building wdt:P6375 ?address .}
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
}

Try it!


Mappa delle località con un certo nome[edit]

#defaultView:Map
SELECT ?item ?coord ?itemLabel
WHERE {
  { ?item rdfs:label "Castelli"@it. }
  UNION
  { ?item rdfs:label "Castello"@it. }
  UNION
  { ?item rdfs:label "castelli"@it. }
  UNION
  { ?item rdfs:label "castello"@it. }
  UNION
  { ?item rdfs:label "Castelli"@en. }
  UNION
  { ?item rdfs:label "Castello"@en. }
  UNION
  { ?item rdfs:label "castelli"@en. }
  UNION
  { ?item rdfs:label "castello"@en. }
  ?item wdt:P625 ?coord
}

Try it!

Civiltà nuragica[edit]

#defaultView:Map{"hide":["?coord"], "layer": "?nu"}
SELECT ?item ?itemLabel ?coord ?nur (CONTAINS(?nur,"NUR") AS ?nu) WHERE {
  ?item wdt:P625 ?coord.
  {
   { ?item wdt:P31 wd:Q688292.}
  UNION
   { ?item wdt:P31 wd:Q1385277.}
  UNION
   { ?item wdt:P31 wd:Q3909778.}
  UNION
   { ?item wdt:P31 wd:Q1523627.}
  UNION
   { ?item wdt:P31 wd:Q1238775.}
  }
     SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE],en" .
   }
  OPTIONAL { ?item wdt:P11982 ?nur. }
}

Try it!

Lingua Italiana[edit]

Lessemi[edit]

select ?lexemeId ?lemma WHERE {
  ?lexemeId dct:language wd:Q652;
            wikibase:lemma ?lemma.
}

Try it!

Wordlist italiana[edit]

SELECT DISTINCT ?word WHERE {
  ?l ontolex:lexicalForm ?form;
    dct:language wd:Q652.
  ?form rdf:type ontolex:Form;
    ontolex:representation ?word.
}

Try it!

Rimario[edit]

SELECT DISTINCT ?word ?category WHERE {
  ?l ontolex:lexicalForm ?form;
    wikibase:lexicalCategory ?category;
    dct:language wd:Q652.
  ?form rdf:type ontolex:Form;
    ontolex:representation ?word.
  FILTER(REGEX(?word, ".*esto$"))
}
ORDER BY ?category

Try it!

Lessemi italiani, genere gramm. e identificativo nel vocabolario Treccani[edit]

SELECT ?l ?lemma ?catLabel ?genere ?treccani WHERE {
  ?l dct:language wd:Q652;
    wikibase:lemma ?lemma;
    wikibase:lexicalCategory ?cat.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,it". }
  OPTIONAL { ?l wdt:P5185 ?genere. }
  OPTIONAL { ?l wdt:P5844 ?treccani. }
}
ORDER BY ?treccani ?catLabel

Try it!

Lessemi italiani senza forme[edit]

#title:Lexemes in Italian without forms
SELECT ?lexemeId ?lemma
WHERE {
  ?lexemeId dct:language wd:Q652;
            wikibase:lemma ?lemma.
  MINUS {
  ?lexemeId dct:language wd:Q652;
            wikibase:lemma ?lemma;
            ontolex:lexicalForm ?form.
  }
}

Try it!

Lessemi italiani senza sensi[edit]

#title:Lexemes in Italian without senses
SELECT ?lexemeId ?lemma
WHERE {
  ?lexemeId dct:language wd:Q652;
            wikibase:lemma ?lemma.
  MINUS {
  ?lexemeId dct:language wd:Q652;
            wikibase:lemma ?lemma;
            ontolex:sense ?s.
  }
}

Try it!

Lingue e numero di lessemi inseriti[edit]

SELECT ?langLabel ?count
WHERE
{
  {
    SELECT ?lang (COUNT(?l) as ?count) 
    WHERE {
      ?l dct:language ?lang.
    }
    GROUP BY ?lang
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
  }
}
ORDER BY DESC(?count)

Try it!

Conteggio di lessemi italiani, forme, sensi per categoria[edit]

SELECT ?category ?categoryLabel (COUNT(distinct ?l) as ?lexemeCount) (COUNT(distinct ?f) AS ?formCount)  (COUNT(distinct ?s) AS ?senseCount) 
WHERE {
   ?l a ontolex:LexicalEntry ;
        wikibase:lemma ?word ;
        wikibase:lexicalCategory ?category;
        dct:language [wdt:P218 'it'].
   OPTIONAL { ?l ontolex:lexicalForm ?f. }
   OPTIONAL { ?l ontolex:sense ?s. }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} 
GROUP BY ?category ?categoryLabel
ORDER BY DESC(?lexemeCount)

Try it!

Lessemi che finiscono con "ese" ed eventuali demonimi[edit]

SELECT ?lexemeId ?lemma ?demonimoLabel WHERE {
  ?lexemeId dct:language wd:Q652;
    wikibase:lemma ?lemma;
  FILTER(REGEX(?lemma, ".*ese$"))
  OPTIONAL { 
    ?lexemeId ontolex:sense ?sense.
    ?sense wdt:P6271 ?demonimo.
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it". }
}

Try it!

Check su identificativo de mauro per underscore[edit]

SELECT ?lexemeId ?lemma ?dm
WHERE {
  ?lexemeId dct:language wd:Q652;
            wikibase:lemma ?lemma.
  ?lexemeId wdt:P12420 ?dm.
  
  FILTER(REGEX(?dm, ".*_.*"))
}

Try it!

Demonimi italiani sulla mappa[edit]

#defaultView:Map
SELECT ?l ?lemma ?demoPlaceLabel ?coords WHERE {
  ?l a ontolex:LexicalEntry ; 
       dct:language ?language ;
       wikibase:lemma ?lemma .
  ?language wdt:P218 'it'. # language
  ?l ontolex:sense ?sense.
     ?sense wdt:P6271 ?demoPlace.
  ?demoPlace wdt:P625 ?coords
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it,en". }
}

Try it!

Forme di lessemi che contengono una doppia i[edit]

SELECT ?lexemeId ?lemma ?word WHERE {
  ?lexemeId dct:language wd:Q652.
  ?lexemeId wikibase:lexicalCategory wd:Q24905.
  ?lexemeId wikibase:lemma ?lemma.
  ?lexemeId ontolex:lexicalForm ?form.
  ?form ontolex:representation ?word.
  #FILTER(REGEX(?word, ".*ato$"))
  FILTER(REGEX(?word, ".*ii.*"))
  #SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it". }
}
#https://en.wikibooks.org/wiki/SPARQL/WIKIDATA_Lexicographical_data

Try it!

Dialetto Veneto[edit]

Uccelli con nome in dialetto veneto e immagine[edit]

#defaultView:ImageGrid
  SELECT ?item ?itemLabel (SAMPLE(?pic) as ?picture)
  WHERE
  {
      ?item 
            wdt:P171* wd:Q5113 ;
            wdt:P105 wd:Q7432 ;
            wdt:P31 wd:Q16521 ;
            wdt:P225 ?sciName ;
            wdt:P18 ?pic;
            rdfs:label ?itemLabel ;
            filter (lang(?itemLabel) = "vec").
            FILTER(str(?itemLabel) != str(?sciName)).
  }
  GROUP BY ?item ?itemLabel
  ORDER BY ?itemLabel

Try it!

Mammiferi con nome in dialetto veneto e immagine[edit]

#defaultView:ImageGrid
  SELECT ?item ?itemLabel (SAMPLE(?pic) as ?picture)
  WHERE
  {
      ?item 
            wdt:P171* wd:Q7377 ;
            wdt:P105 wd:Q7432 ;
            wdt:P31 wd:Q16521 ;
            wdt:P225 ?sciName ;
            wdt:P18 ?pic;
            rdfs:label ?itemLabel ;
            filter (lang(?itemLabel) = "vec").
            FILTER(str(?itemLabel) != str(?sciName)).
  }
  GROUP BY ?item ?itemLabel
  ORDER BY ?itemLabel

Try it!

Pesci spinati con nome in dialetto veneto e immagine[edit]

#defaultView:ImageGrid
  SELECT ?item ?itemLabel (SAMPLE(?pic) as ?picture)
  WHERE
  {
      ?item 
            wdt:P171* wd:Q127282 ;
            wdt:P105 wd:Q7432 ;
            wdt:P31 wd:Q16521 ;
            wdt:P225 ?sciName ;
            wdt:P18 ?pic;
            rdfs:label ?itemLabel ;
            filter (lang(?itemLabel) = "vec").
            FILTER(str(?itemLabel) != str(?sciName)).
  }
  GROUP BY ?item ?itemLabel
  ORDER BY ?itemLabel

Try it!

Cocktails[edit]

SELECT distinct ?item ?itemLabel ?identificativo_drink_TheCocktailDB WHERE {
  { ?item wdt:P31 wd:Q2536409. }
  UNION
  { ?item wdt:P31 wd:Q134768. }
  UNION
  { ?item wdt:P279 wd:Q2536409. }
  UNION
  { ?item wdt:P279 wd:Q134768. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?item wdt:P9056 ?identificativo_drink_TheCocktailDB. }
}

Try it!

Mix n Match[edit]

# Authority Control properties for people, without Mix'n'match catalog
SELECT ?p ?pLabel WHERE {
  ?p rdf:type wikibase:Property;
    wdt:P31 wd:Q19595382.
  MINUS { ?p wdt:P2264 _:b2. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by ?pLabel

Try it!

Go tournament[edit]

SELECT ?item ?itemLabel ?sport ?sportLabel ?ediz WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?item p:P31 _:b20.
  _:b20 ps:P31 wd:Q27020041;
    pq:P642 wd:Q675180.
  OPTIONAL { ?item wdt:P641 ?sport. }
  OPTIONAL { ?item wdt:P393 ?ediz. }
}

Try it!

Musica[edit]

Vincitori del festival di Sanremo[edit]

Gruppi italiani senza ident. Deezer[edit]

SELECT ?band ?bandLabel
WHERE
{
  # ?band (wdt:P31)* wd:Q215380 .
  ?band wdt:P31 wd:Q215380 .
  ?band wdt:P495 wd:Q38.
  # ?band wdt:P136 wd:Q9794.
  MINUS { ?band wdt:P2722 [] }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,it". }
}

Try it!


Tech[edit]

Engine families and models[edit]

SELECT ?item ?itemLabel ?configurazione_del_motoreLabel ?cilindri ?fabbricanteLabel ?sottoclasse_diLabel WHERE {
  { ?item wdt:P31 wd:Q15057021. }
  UNION
  { ?item wdt:P31 wd:Q15057020. }
  UNION
  { ?item wdt:P31 wd:Q118017625. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?item wdt:P1002 ?configurazione_del_motore. }
  OPTIONAL { ?item wdt:P1100 ?cilindri. }
  OPTIONAL { ?item wdt:P176 ?fabbricante. }
  OPTIONAL { ?item wdt:P279 ?sottoclasse_di. }
}

Try it!

Items that we might reconsider as engine models or families[edit]

SELECT DISTINCT ?item ?itemLabel ?configurazione_del_motoreLabel ?cilindri ?fabbricanteLabel ?sottoclasse_diLabel WHERE {

  { ?item wdt:P31 wd:Q502048. }
  UNION
  { ?item wdt:P31 wd:Q743004. }
  UNION
  { ?item wdt:P31 wd:Q1566051. }
  UNION
  { ?item wdt:P31 wd:Q946676. }
  UNION
  { ?item wdt:P31 wd:Q724736. }
  UNION
  { ?item wdt:P31 wd:Q12757. }
  UNION
  { ?item wdt:P31 wd:Q630010. }
  UNION
  { ?item wdt:P31 wd:Q1779063. }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?item wdt:P1002 ?configurazione_del_motore. }
  OPTIONAL { ?item wdt:P1100 ?cilindri. }
  OPTIONAL { ?item wdt:P176 ?fabbricante. }
  OPTIONAL { ?item wdt:P279 ?sottoclasse_di. }
}
ORDER BY ASC (?itemLabel)

Try it!

Snippet[edit]

BIND(strafter(str(?item), "http://www.wikidata.org/entity/Q") AS ?numericId)
    FILTER (?numericId >= 1 && ?numericId <= 10000)

Try it!