Wikidata querying demo

From Discourse DB
Jump to navigation Jump to search

The following are demonstrations of how Wikidata can be queried using the External Data extension.

Individual entry

SPARQL query:

SELECT ?item ?itemLabel ?symbol ?atomicNumber ( YEAR( ?discoveryDate ) AS ?discoveryYear ) ?discoverer ?discovererLabel
WHERE {
  VALUES ?item { wd:Q654 } .
  ?item wdt:P246 ?symbol .
  ?item wdt:P1086 ?atomicNumber .
  ?item wdt:P575 ?discoveryDate .
  ?item wdt:P61 ?discoverer
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Info for Q654:

Full query

All paintings that depict a squirrel.

SPARQL query:

SELECT DISTINCT ?painting ?paintingLabel ?creator ?creatorLabel ( YEAR( ?inception ) as ?year ) ?genre ?genreLabel ( SUBSTR( ?str_image, 52 ) AS ?fileName )
WHERE
{
  ?painting wdt:P180 wd:Q9482 .
  ?painting wdt:P170 ?creator .
  ?painting wdt:P571 ?inception .
  ?painting wdt:P136 ?genre .
  ?painting wdt:P18 ?image .
  BIND (STR(?image) AS ?str_image)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?paintingLabel


Name Artist Year Genre Image
Q111135100 Willy Blees 1967 public art Eekhoorn Willy Blees Notebomenlaan Utrecht.JPG
Animals. Ernst Wilhelm Bernhardi 1708 animal art Bernhardi Animals.jpg
Basket of red and green grapes with fruits of the hunt, including a goldfinch Clara Peeters 1640 still life Clara peeters a basket of red and green grapes a goldfinch game and a114828).jpg
Forest still life with squirrel Anna Ruysch 1685 still life Anna Elisabeth Ruysch - Dickicht mit Blumen und Tieren - 378 - Staatliche Kunsthalle Karlsruhe.jpg
Forest still life with squirrel Anna Ruysch 1685 still life Anna Ruysch - Forest Floor kunstobjekt 00118.jpg
Fruit bowl, basket, vegetables and a squirrel Gommaert van der Gracht 1645 still life Gommaar van der Gracht - Mand, vruchtenschaal, groenten en een eekhoorn.jpg
Fruit bowl, basket, vegetables and a squirrel Gommaert van der Gracht 1645 landscape art Gommaar van der Gracht - Mand, vruchtenschaal, groenten en een eekhoorn.jpg
Fruit still life with goldfinch and squirrel Abraham Mignon 1668 still life Abraham Mignon - Fruit Still-Life with Squirrel and Goldfinch - WGA15666.jpg
Fruits, Carnation and Squirrel Frans Snyders 1611 still life Frans Snyders - Fruits, Carnation and Squirrel.jpg
Genoveva-Brunnen Hermann Hosaeus 1928 public art Genoveva-Brunnen Spandau2.jpg
Order of the Cub Scout Tom Frantzen 1994 public art Orde van de Welp by Tom Frantzen 02.jpg
Pomona in a fruit garland and surrounded by animals Gommaert van der Gracht 1645 still life Gommaar van der Gracht - Pomona omringd door een bloemenguirlande en dieren.jpg
Squirrels with Stag Horn Therese Richter 1809 still life Therese Richter - Squirrels with Stag Horn.jpg
Squirrels with Stag Horn Therese Richter 1809 animal art Therese Richter - Squirrels with Stag Horn.jpg
Still Life of Fruit, a Lobster, Cheeses and Drinking Vessels with a Parrot and a Squirrel on a Table Artus Claessens 1650 still life Artus Claessens - Still Life of Fruit, a Lobster, Cheeses and Drinking Vessels with a Parrot and a Squirrel on a Table.jpg
Still Life with Fruit and a Squirrel Catharina Treu 1780 still life Catharina Treu - Vruchtenstilleven met een schelp en een eekhoorn - 399 - Staatliche Kunsthalle Karlsruhe.jpg
Still life with a basket of fruit, vegetables and a squirrel Abraham Gibbens 1635 still life Abraham Gibbens - Still life with a basket of fruit, vegetables and a squirrel, 1635.jpg
Still-Life with a Basket of Fruit, a Squirrel, and a Cat Frans Snyders 1639 still life Frans Snyders - Still-Life with a Basket of Fruit - WGA21523.jpg
Two Squirrels Albrecht Dürer 1512 animal art Durer-ecureuil.jpg

Map display

Map of all buildings in Spain with Baroque architecture.

SPARQL query:

SELECT ?item ?itemLabel ?lon ?lat
WHERE
{
 ?item wdt:P31 wd:Q41176. # type = building
 ?item wdt:P17 wd:Q29. # country = Spain
 ?item wdt:P149 wd:Q37853. # architecture = Baroque
 ?item p:P625 ?coordinate.
 ?coordinate psv:P625 ?coordinate_node.
 ?coordinate_node wikibase:geoLongitude ?lon.
 ?coordinate_node wikibase:geoLatitude ?lat.  
 SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } 
}