Work in progress
Intro
Queries exp
My queries (showcase)
Sources
GWMAB
IRIS
Strategy
All icons
All subpages

User:Epìdosis/Queries/Showcase

From Wikidata
Jump to navigation Jump to search


Ancient Greece[edit]

#Greek mythological characters
SELECT ?item ?itemLabel ?gender ?genderLabel ?father ?fatherLabel
		?mother ?motherLabel (GROUP_CONCAT(?childLabel; separator=", ") as ?children)
WHERE {
  { ?item wdt:P31 ?instance .
  	values ?instance { wd:Q22988604}
  }
  	UNION
  { ?item wdt:P31 ?instance .
   	?instance wdt:P279 wd:Q22988604 .
  }
  ?item wdt:P21 ?gender .
  ?item wdt:P22 ?father .
  ?item wdt:P25 ?mother .
  ?item wdt:P40 ?child .
  ?child rdfs:label ?childLabel FILTER(lang(?childLabel)="en")
  
      SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en" .
    }
  }
GROUP BY ?item ?itemLabel ?gender ?genderLabel ?father ?fatherLabel ?mother ?motherLabel
Try it!

Ancient works[edit]

#title:Perseus work abbreviations
SELECT ?abbr ?work ?workLabel ?author ?authorLabel
WHERE {
  ?work p:P8703 [ pq:P1535 wd:Q639661 ; ps:P8703 ?abbr ] .
  OPTIONAL { ?work wdt:P50 ?author } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?abbr
Perseus work abbreviations

Ancient places[edit]

#defaultView:Map
SELECT DISTINCT ?place ?placeLabel ?coord ?pleiades ?vici ?dare ?trismegistos ?amphitheatrum ?theatrum ?arachne ?topostext ?hansen ?idai ?archaeologyingreece
WHERE {
  { ?place wdt:P1584 ?pleiades . } UNION
  { ?place wdt:P1481 ?vici . } UNION
  { ?place wdt:P1936 ?dare . } UNION
  { ?place wdt:P1958 ?trismegistos . } UNION
  { ?place wdt:P5633 ?amphitheatrum . } UNION
  { ?place wdt:P5634 ?theatrum . } UNION
  { ?place wdt:P6787 ?arachne . } UNION
  { ?place wdt:P8068 ?topostext . } UNION
  { ?place wdt:P8137 ?hansen . } UNION
  { ?place wdt:P8217 ?idai . } UNION
  { ?place wdt:P8218 ?archaeologyingreece . }
  OPTIONAL { ?place wdt:P625 ?coord . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it,en,de,es". }
}
Try it!
#Theaters and amphitheaters
#defaultView:Map
SELECT DISTINCT ?place ?placeLabel ?coord
(URI(CONCAT("http://amphi-theatrum.de/",?amphitheatrum,".html")) AS ?amphitheatrumUrl)
(URI(CONCAT("http://theatrum.de/",?theatrum,".html")) AS ?theatrumUrl)
WHERE {
  { ?place wdt:P5633 ?amphitheatrum . } UNION
  { ?place wdt:P5634 ?theatrum . }
  OPTIONAL { ?place wdt:P625 ?coord . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it,en,de,es". }
}
Try it!
#defaultView:Map
SELECT DISTINCT ?place ?placeLabel ?coord
WHERE {
  ?place wdt:P31/wdt:P279* wd:Q839954 . 
  ?place wdt:P17 wd:Q38 .
  OPTIONAL { ?place wdt:P625 ?coord . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it,en,de,es". }
}
Try it!

Classics[edit]

# Classical scholars born or dead today
SELECT ?person ?personLabel ?personDescription (YEAR(?dateBirth) as ?yearBirth) (YEAR(?dateDeath) as ?yearDeath)
WHERE {
    { ?person wdt:P106 wd:Q2468727 . } UNION { ?person wdt:P106 ?occ . ?occ wdt:P279 wd:Q2468727 }
    { ?person wdt:P569 ?dateBirth . 
    BIND(MONTH(NOW()) AS ?nowMonthBirth)
    BIND(DAY(NOW()) AS ?nowDayBirth)
    FILTER (MONTH(?dateBirth) = ?nowMonthBirth && DAY(?dateBirth) = ?nowDayBirth) }
    UNION { ?person wdt:P570 ?dateDeath . 
    BIND(MONTH(NOW()) AS ?nowMonthDeath)
    BIND(DAY(NOW()) AS ?nowDayDeath)
    FILTER (MONTH(?dateDeath) = ?nowMonthDeath && DAY(?dateDeath) = ?nowDayDeath) }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE]". }
}
ORDER BY ?yearDeath ?yearBirth
Try it!

SNS[edit]

#title:Direttori della Scuola Normale Superiore
SELECT DISTINCT ?item ?itemLabel ?ordinal ?birthyear ?deadyear ?startyear ?endyear ?trec
WHERE {
  ?item p:P39 ?position .
  ?position ps:P39 wd:Q41210386 .
  ?position pq:P1545 ?ordinal .  
  OPTIONAL { ?item wdt:P569 ?db. }
  OPTIONAL { ?item wdt:P570 ?dd. }
  OPTIONAL { ?position pq:P580 ?st. }
  OPTIONAL { ?position pq:P582 ?en. }
  OPTIONAL { ?item wdt:P3365 ?trec. }
  BIND(str(YEAR(?db)) AS ?birthyear)
  BIND(str(YEAR(?dd)) AS ?deadyear)
  BIND(str(YEAR(?st)) AS ?startyear)
  BIND(str(YEAR(?en)) AS ?endyear)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it". }
}
ORDER BY ASC(xsd:integer(?ordinal))
Direttori della Scuola Normale Superiore

Toscana[edit]

#defaultView:Map
SELECT ?item ?itemLabel ?itemDescription ?inst ?coord ?img ?com ?gmp ?tra ?layer
WHERE {
  ?item (wdt:P131)* wd:Q1273 . 
  ?item wdt:P31 ?inst .
  { ?item (wdt:P31/wdt:P279*) wd:Q33506 . } UNION { ?item wdt:P31 wd:Q839954 . }
  ?item wdt:P625 ?coord . 
  OPTIONAL {?item wdt:P18 ?img}
  OPTIONAL {?item wdt:P373 ?com}
  OPTIONAL {?item wdt:P3749 ?gmp}
  OPTIONAL {?item wdt:P3134 ?tra}
  BIND(IF(BOUND(?gmp) && BOUND(?tra),"gmp & tra exist",IF(BOUND(?tra),"tra exists",IF(BOUND(?gmp),"gmp exists","none"))) AS ?layer)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it,en". }
}
Try it!
SELECT DISTINCT ?elemento ?elementoLabel ?elementoDescription ?anno_nascita ?anno_morte ?luogo ?luogoLabel ?nw ?ni #?coord
WHERE {
  ?elemento wdt:P19 ?luogo .
  ?luogo wdt:P131* wd:Q16245 .
  OPTIONAL { ?luogo wdt:P625 ?coord . }
  ?elemento wikibase:sitelinks ?nw . FILTER(?nw > 9)
  ?elemento wikibase:identifiers ?ni . FILTER(?ni > 9)
  OPTIONAL { ?elemento p:P569 [ a wikibase:BestRank; psv:P569 [ wikibase:timeValue ?nascita ] ] . BIND(YEAR(?nascita) AS ?anno_nascita) }
  OPTIONAL { ?elemento p:P570 [ a wikibase:BestRank; psv:P570 [ wikibase:timeValue ?morte ] ] . BIND(YEAR(?morte) AS ?anno_morte) }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it,en". }
}
ORDER BY DESC(?ni)
Try it!

Lucca[edit]

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

Senza coordinate

SELECT ?item ?itemLabel ?itemDescription ?img ?com
WHERE {
  ?item (wdt:P131)* wd:Q13373 . 
  MINUS { { ?item wdt:P31 wd:Q1134686 . } UNION { ?item wdt:P31 wd:Q747074 . } }
  MINUS { ?item wdt:P625 ?coord . }
  OPTIONAL {?item wdt:P18 ?img}
  OPTIONAL {?item wdt:P373 ?com}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],it,en". }
}
Try it!

Verona[edit]

#Elementi in comune di Verona
#defaultView:Map
SELECT ?item ?itemLabel ?coord
WHERE { 
  ?item wdt:P131 ?sub1 . 
  ?sub1 (wdt:P131)* wd:Q2028 .
  ?item wdt:P625 ?coord .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "it" }
}
Try it!
#Chiese facenti parte del percorso "Rinascere dall'acqua" di "Verona Minor Hierusalem"
#defaultView:Map
SELECT ?item ?itemLabel ?image ?coord
WHERE 
{ 
  wd:Q28526880 wdt:P527 ?item .
  ?item wdt:P18 ?image .
  ?item wdt:P625 ?coord .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "it" }
}
Try it!

Art history[edit]

# Works by Canova
SELECT
  ?work ?workLabel (GROUP_CONCAT(DISTINCT ?instanceLabel; separator=", ") AS ?inst)
  (GROUP_CONCAT(DISTINCT STR(YEAR(?date)); separator=", ") AS ?date)
  (GROUP_CONCAT(DISTINCT ?genreLabel; separator=", ") AS ?genre)
  (GROUP_CONCAT(DISTINCT ?materialLabel; separator=", ") AS ?material) (SAMPLE(?image) AS ?image)
WHERE {
  ?work wdt:P170 wd:Q5547;
        wdt:P31 ?instance;
        wdt:P136 ?genre;
        wdt:P571 ?date;
        wdt:P186 ?material;
        wdt:P18 ?image .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it,fr" .
    ?work rdfs:label ?workLabel .
    ?instance rdfs:label ?instanceLabel .
    ?genre rdfs:label ?genreLabel .
    ?material rdfs:label ?materialLabel .
  } .
} GROUP BY ?work ?workLabel
ORDER BY ?date
Try it!
# Caprichos by Goya
#defaultView:ImageGrid
SELECT ?inc ?incLabel ?image
WHERE {
  ?inc wdt:P179 wd:Q1163663 .
  ?inc wdt:P18 ?image .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "es" }
}
Try it!
# Works by Manet
#defaultView:ImageGrid
SELECT ?work ?workLabel ?image
WHERE {
  ?work wdt:P170 wd:Q40599 .
  ?work wdt:P18 ?image .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "it,fr,en" }
}
Try it!

Biographical dictionaries[edit]

SELECT ?item ?itemLabel ?paeseLabel ?lLabel ?genLabel ?nb
WHERE {
  ?item wdt:P31 wd:Q97584729 .
  OPTIONAL { ?item wdt:P17 ?paese } .
  OPTIONAL { ?item wdt:P9073 [ wdt:P136 ?gen ; wdt:P1813 ?nb ] } .
  OPTIONAL { ?item p:P1552 [ ps:P1552 wd:Q102746314 ; pq:P407 ?l ] } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?itemLabel
Try it!

Etc.[edit]

#title:Presidenti della CRUI
SELECT DISTINCT ?item ?itemLabel ?ordinal ?birthyear ?deadyear ?startyear ?endyear ?sbn
WHERE {
  ?item p:P39 ?position .
  ?position ps:P39 wd:Q110573215 .
  ?position pq:P1545 ?ordinal .  
  OPTIONAL { ?item wdt:P569 ?db } .
  OPTIONAL { ?item wdt:P570 ?dd } .
  OPTIONAL { ?position pq:P580 ?st } .
  OPTIONAL { ?position pq:P582 ?en } .
  OPTIONAL { ?item wdt:P396 ?sbn } .
  BIND(STR(YEAR(?db)) AS ?birthyear)
  BIND(STR(YEAR(?dd)) AS ?deadyear)
  BIND(STR(YEAR(?st)) AS ?startyear)
  BIND(STR(YEAR(?en)) AS ?endyear)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it". }
}
ORDER BY ASC(xsd:integer(?ordinal))
Presidenti della CRUI