Help:Contributing/query

From Wikibase
Jump to navigation Jump to search

Languages: English · français · Esperanto

This page shows how to query the knowledge base with SPARQL. Start at the Help:Contributing hub if you are new here.

The endpoint

The public SPARQL endpoint is https://wikibase.ronzz.org/sparql.

A first query

All books in the knowledge base:

SELECT ?book ?bookLabel WHERE {
  ?book wdt:P1 wd:Q9 .            # instance of (P1) → book (Q9)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

The wdt: prefix reads the values of a property; wd: names an entity. On this instance, instance of is P1 and book is Q9.

The Wikidata SPARQL tutorial works verbatim on this instance. For the full syntax reference, see Cheatsheets:SPARQL.

See also