Wikidata:WikiProject Italy/Queries

Ricerche base edit

Mappa di tutto ciò che è in Florence (Q2044) in base alla located in the administrative territorial entity (P131).

#defaultView:Map
SELECT ?item ?itemLabel ?coord
WHERE { 
  ?item wdt:P131 ?sub1 . 
  ?sub1 (wdt:P131)* wd:Q2044 .
  ?item wdt:P625 ?coord .
  { ?sitelink schema:about ?item . ?sitelink schema:inLanguage "it" }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it,en" . }
 }
Try it!

Elementi senza una image (P18) nell'area di Livorno (Q6761)

#defaultView:Map
SELECT ?item ?itemLabel ?coord WHERE {
  ?item wdt:P131 ?sub1.
  ?sub1 wdt:P131* wd:Q6761. # Livorno (Q6761)
  ?item wdt:P625 ?coord.
  OPTIONAL { ?item wdt:P18 ?dummy0. }
  FILTER(!BOUND(?dummy0))
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

Chiese in Italy (Q38) (Max. 500)

#Mappa delle chiese in Italia (max 500)
#added 2017-08
#defaultView:Map
SELECT * WHERE {
  ?item wdt:P17 wd:Q38 .
  ?item wdt:P31*/wdt:P279* wd:Q16970;
        wdt:P625 ?geo .
}
LIMIT 500
Try it!

Controllo di autorità edit

Elementi con controllo di autorità di biblioteche italiane: https://w.wiki/tC4

SELECT ?item ?vcba ?pust ?pusc ?urbs ?piac ?sbn ?share ?asut ?omg
WHERE {
  { ?item wdt:P8034 ?vcba . } UNION
  { ?item wdt:P5731 ?pust . } UNION
  { ?item wdt:P5739 ?pusc . } UNION
  { ?item wdt:P8750 ?urbs . } UNION
  { ?item wdt:P8982 ?piac . } UNION
  { ?item wdt:P396 ?sbn . } UNION
  { ?item wdt:P3987 ?share . } UNION
  { ?item wdt:P8219 ?asut . } UNION
  { ?item wdt:P8947 ?omg . }
}
Try it!

Elementi con controllo di autorità di biblioteche romane: https://w.wiki/tC2

SELECT ?item ?vcba ?pust ?pusc ?urbs ?piac
WHERE {
  { ?item wdt:P8034 ?vcba . } UNION
  { ?item wdt:P5731 ?pust . } UNION
  { ?item wdt:P5739 ?pusc . } UNION
  { ?item wdt:P8750 ?urbs . } UNION
  { ?item wdt:P8982 ?piac . }
}
Try it!

Wiki Loves Monuments edit

Mappa di tutto ciò che è in Tuscany (Q1273) in base alla located in the administrative territorial entity (P131); mostra in blu gli elementi che hanno Google Maps Customer ID (P3749) e in arancione quelli che non ce l'hanno (con possibilità di visualizzare solo gli uni o gli altri); modificando "gmp" con un'altro codice nella riga con BIND si può applicare anche ad un'altra delle proprietà in lista.

#defaultView:Map
SELECT ?item ?itemLabel ?itemDescription ?coord ?gmp ?gkg ?geo ?ind ?com ?wlm ?layer
WHERE {
  ?item (wdt:P131)* wd:Q1273 . 
  MINUS { ?item wdt:P31 wd:Q1134686 . }
  ?item wdt:P625 ?coord . 
  OPTIONAL {?item wdt:P3749 ?gmp}
  OPTIONAL {?item wdt:P2671 ?gkg}
  OPTIONAL {?item wdt:P1566 ?geo}
  OPTIONAL {?item wdt:P969 ?ind}
  OPTIONAL {?item wdt:P373 ?com}
  OPTIONAL {?item wdt:P2186 ?wlm}
  BIND(IF(BOUND(?gmp),'gmp exists','no gmp exists') AS ?layer)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it,en". }
}
Try it!

Mappa di tutto ciò che è in Tuscany (Q1273) in base alla located in the administrative territorial entity (P131); mostra in colori diversi gli elementi che hanno sia Google Maps Customer ID (P3749) sia Commons category (P373), quelli che hanno solo una delle due e quelli che non le hanno entrambe (con possibilità di visualizzare solo gli uni o gli altri); sono esclusi frazione (Q1134686) e commune of Italy (Q747074) perché non hanno mai un Google Maps Customer ID (P3749).

#defaultView:Map
SELECT ?item ?itemLabel ?itemDescription ?coord ?gmp ?gkg ?ind ?com ?wlm ?layer
WHERE {
  ?item (wdt:P131)* wd:Q1273 . 
  MINUS { { ?item wdt:P31 wd:Q1134686 . } UNION { ?item wdt:P31 wd:Q747074 . } }
  ?item wdt:P625 ?coord . 
  OPTIONAL {?item wdt:P3749 ?gmp}
  OPTIONAL {?item wdt:P2671 ?gkg}
  OPTIONAL {?item wdt:P969 ?ind}
  OPTIONAL {?item wdt:P373 ?com}
  OPTIONAL {?item wdt:P2186 ?wlm}
  BIND(IF(BOUND(?gmp) && BOUND(?com),"gmp & com exist",IF(BOUND(?com),"com exists",IF(BOUND(?gmp),"gmp exists","none"))) AS ?layer)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it,en". }
}
Try it!

Mappa di tutto ciò che è in un raggio di 15 km attorno alla Florence Cathedral (Q191739) ed è privo di located in the administrative territorial entity (P131); è escluso human settlement (Q486972) perché sono le tipiche frazioni di ceb.wiki.

#defaultView:Map
SELECT ?item ?itemLabel ?coord
WHERE {
  wd:Q191739 wdt:P625 ?center
  SERVICE wikibase:around {
  ?item wdt:P625 ?coord .
  bd:serviceParam wikibase:center ?center .
  bd:serviceParam wikibase:radius "15" . }
  MINUS { ?item wdt:P131 ?adm . }
  MINUS { ?item wdt:P31 wd:Q486972 . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it,en". }
}
Try it!

Categorie Commons precisabili edit

SELECT ?item ?itemLabel ?wikiloves ?commons WHERE {
  ?item wdt:P2186 ?wikiloves .
  ?item wdt:P17 wd:Q38 .
  ?item wdt:P373 ?commons.
  {
    SELECT ?commons2  WHERE {
    ?item2 wdt:P2186 ?wikiloves .
    ?item2 wdt:P17 wd:Q38 .
    ?item2 wdt:P373 ?commons2.
    }
    GROUP BY ?commons2
    HAVING (COUNT(?commons2) >1)
  }
  FILTER(?commons = ?commons2)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it". }
}
ORDER BY ?commons2
Try it!

Categorie di Commons da creare o collegare con P18 edit

#defaultView:Map
SELECT ?item ?itemLabel (URI(REPLACE(str(?pic), 'Special:FilePath/', 'File:')) AS ?pic_url) ?pic ?coord WHERE {
   ?item wdt:P18 ?pic .
   wd:Q13377 wdt:P625 ?Loc . 
   SERVICE wikibase:around { 
      ?item wdt:P625 ?coord . 
      bd:serviceParam wikibase:center ?Loc . 
      bd:serviceParam wikibase:radius "30" . 
      bd:serviceParam wikibase:distance ?dist.
   } 
   FILTER NOT EXISTS {?item wdt:P373 ?commonscat} .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en", "it", "fr", "nl" . }         
} # LIMIT 100
Try it!

Altre query (sotto-pagine) edit