Utente:Galessandroni/Wikidata

Presidenti della Repubblica Italiana modifica

#Presidenti della Repubblica italiana
#defaultView:Timeline

SELECT DISTINCT ?pres ?presLabel ?picture ?start ?end ?days WHERE
{
  ?pres wdt:P31 wd:Q5 ;
        p:P39 ?position_statement .
  ?position_statement ps:P39 ?position ;
                      pq:P580 ?start .
  ?position wdt:P279* wd:Q332711 .
  OPTIONAL { ?position_statement pq:P582 ?x }
  OPTIONAL { ?pres wdt:P18 ?picture }
  BIND(IF(BOUND(?x), ?x, NOW()) as ?end )
  BIND(FLOOR(?end - ?start) as ?days)

  SERVICE wikibase:label { bd:serviceParam wikibase:language "it" . }
} ORDER BY ?start

Provala!

Presidenti del Consiglio della Repubblica Italiana modifica

#Presidenti del Consiglio della Repubblica italiana

SELECT ?pres ?presLabel ?start ?end ?days WHERE {
   ?pres wdt:P31 wd:Q5 .
   ?pres p:P39 ?position_held_statement .
   ?position_held_statement ps:P39 wd:Q796897 .
   ?position_held_statement pq:P580 ?start .
   OPTIONAL { ?position_held_statement pq:P582 ?x . }
   BIND(IF(BOUND(?x), ?x, NOW()) as ?end )
   BIND(FLOOR(?end - ?start) as ?days)

   SERVICE wikibase:label { bd:serviceParam wikibase:language "it". }
} ORDER BY ?start

Provala!

Beni culturali con codice Wiki Loves Monuments con e senza immagine delle Marche modifica

Beni architettonici modifica

#Beni architettonici con codice WLM nelle Marche con e senza immagine
#defaultView:Map

SELECT ?bene ?beneLabel ?wlmid ?coords ?img ?layer WHERE {
  ?bene wdt:P2186 ?wlmid;
        wdt:P131/wdt:P131* wd:Q1279 .
  OPTIONAL { ?bene wdt:P625 ?coords . }
  OPTIONAL { ?bene wdt:P18 ?img . }
  FILTER(wdt:P31 != wd:Q811534)
  BIND(IF(BOUND(?img), 'Monumento con immagine', 'Cercasi immagine per monumento') AS ?layer)

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

Provala!

Alberi monumentali modifica

#Alberi monumentali con codice WLM nelle Marche con e senza immagine
#defaultView:Map

SELECT ?bene ?beneLabel ?wlmid ?coords ?img ?layer WHERE {
  ?bene wdt:P2186 ?wlmid;
        wdt:P131/wdt:P131* wd:Q1279 .
  ?bene wdt:P31 wd:Q811534 .
  OPTIONAL { ?bene wdt:P625 ?coords . }
  OPTIONAL { ?bene wdt:P18 ?img . }
  BIND(IF(BOUND(?img), 'Albero con immagine', 'Cercasi immagine per albero') AS ?layer) 
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

Provala!

Entrambi modifica

Query scritta da Francesco Ansanelli

#Beni culturali con codice WLM nelle Marche
#defaultView:Map

SELECT ?bene ?beneLabel ?wlmid ?coords ?img ?layer WHERE {
  ?bene wdt:P2186 ?wlmid;
        wdt:P131/wdt:P131* wd:Q1279 .
  ?bene wdt:P31 ?tipo.
  OPTIONAL { ?bene wdt:P625 ?coords . }
  OPTIONAL { ?bene wdt:P18 ?img . }
  BIND(IF(?tipo NOT IN(wd:Q811534), IF(BOUND(?img), 'Monumento con immagine', 'Cercasi immagine per monumento'), IF(BOUND(?img), 'Albero con immagine', 'Cercasi immagine per albero')) AS ?layer) 
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

Provala!

Scuole superiori della provincia di Pesaro e Urbino modifica

# Scuole superiori della provincia di Pesaro e Urbino (Q16241)

SELECT ?item ?CodiceMeccanografico ?itemLabel ?indirizzo ?comune ?comuneLabel ?coords WHERE {
  ?item wdt:P5114 ?CodiceMeccanografico.
  FILTER(REGEX(?CodiceMeccanografico, "^.{2}[PQRST]"))
  ?item wdt:P131* wd:Q16241.
  OPTIONAL { ?item wdt:P6375 ?indirizzo. }
  OPTIONAL { ?item wdt:P131 ?comune. }
  OPTIONAL { ?item wdt:P625 ?coords. }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
} ORDER BY (?comuneLabel) (?CodiceMeccanografico)

Provala!

Biblioteche in Italia modifica

#Mappa delle biblioteche in Italia
# (Per essere presenti, le biblioteche, devono essere dotate di coordinate!)
#defaultView:Map

SELECT ?library ?libraryLabel ?coords WHERE {
  ?library wdt:P31/wdt:P279* wd:Q7075;
           wdt:P17 wd:Q38.
  OPTIONAL { ?library wdt:P625 ?coords. }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

Provala!

Castelli e fortezze in Italia modifica

#Castelli e fortezze in Italia
#defaultView:Map
SELECT ?item ?itemLabel ?coords
WHERE 
{
  {
    { ?item wdt:P31 wd:Q23413 } # castelli
    UNION
    { ?item wdt:P31 wd:Q1785071 } # forti
    UNION
    { ?item wdt:P31 wd:Q57821 } # fortificazioni
  }.
  ?item wdt:P17 wd:Q38. # in Italia
  
  OPTIONAL { ?item wdt:P625 ?coords. } # se ci sono le coordinate compare nella mappa
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it". }
}

Provala!