Using SHMARQL

A SHMARQL site has four everyday tools. Every page of the site has a header with links to them.

Tool Address Use it to…
SPARQL endpoint /sparql, /sparql/<key> …query the data from scripts, notebooks and other tools.
Query editor /query …write and run SPARQL in the browser, and share queries as links.
Entity viewer /entity?uri=… …look at one resource as a readable page, and download it as RDF.
Documentation pages / …explain your data, with example queries that readers can run.

Data stories and the story editor have a section of their own: Data stories.

The examples use Wikidata

All examples in this documentation query Wikidata through a profile named wikidata (see SPARQL profiles). A few Wikidata basics help when reading them:

  • Every item has a Q-number, and its IRI is http://www.wikidata.org/entity/Q…. Johannes Vermeer is Q41264, Rembrandt is Q5598, painting is Q3305213.
  • Properties have P-numbers. In queries, wdt:P31 means instance of, wdt:P170 creator, wdt:P571 inception (date made), wdt:P195 collection, wdt:P625 coordinate location, wdt:P18 image.
  • The Wikidata Query Service predefines prefixes such as wd:, wdt:, rdfs: and schema:, so the example queries don't declare them.
  • SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } adds a …Label variable with an English label for every variable in the query.