Getting Started

The following methods are available to search the British National Bibliography (BNB) published as Linked Open Data:

SPARQL is a query language for RDF; full details can be found on the W3C website.

The following sample SPARQL queries illustrate some of the ways to query the BNB. You may find it helpful to refer to the published book data model, the forthcoming book data model or the serial data model.  For clarity the PREFIX declarations in each query have been omitted. It should be assumed that each query is preceded by the following PREFIX declarations:

PREFIX bibo: <>
PREFIX bio: <>
PREFIX blt: <>
PREFIX dct: <>
PREFIX event: <>
PREFIX foaf: <>
PREFIX geo: <>
PREFIX isbd: <>
PREFIX org: <>
PREFIX owl: <>
PREFIX rdau: <>
PREFIX rdf: <>
PREFIX rdfs: <>
PREFIX schema: <>
PREFIX skos: <>
PREFIX void: <>
PREFIX xsd: <>

Not all of these declarations are required for all of the queries but they declare all the prefixes that are likely to be useful when querying the BNB.

There are four graphs: one for books (<>); one for serials (<>), one for new and forthcoming books (<>) and one for VoID descriptions (<>). You may query all four graphs by default, or speficy a particular graph.

There are four datasets: BNBBooks (<>), BNBSerials (<>), BNBCIP (<>) and the union of the three: BNB (<>). BNBBooks, BNBSerials, BNBCIP have each been internally de-duplicated but some triples are duplicated between datasets.

Sample query no. 1

How do I search for a book with ISBN 9780729408745?

SELECT ?book ?bnb ?title WHERE {

  #Match the book by ISBN
  ?book bibo:isbn13 "9780729408745";

  #bind some variables to its other attributes
  blt:bnb ?bnb;
  dct:title ?title.

This retrieves the URI for the book, title and BNB number.

Sample query no. 2

Find books on a particular subject, e.g. crystallography

SELECT ?book ?isbn ?title WHERE {
?book dct:subject <>;
 bibo:isbn13 ?isbn;
 dct:title ?title.


This retrieves the URI for the book, the ISBN and the title.

Sample query no. 3

Find books by a particular author, e.g. Iain Banks

SELECT DISTINCT ?book ?title ?isbn WHERE {
?book dct:creator ?author ;
       dct:title ?title.
?author foaf:name "Iain Banks".
OPTIONAL {?book bibo:isbn10 ?isbn}
OPTIONAL {?book bibo:ibsn13 ?isbn}


This retrieves the URI for the book, the title and the ISBN.

Sample query no. 4

Find books by a particular author, e.g. C.S. Lewis, with the most recently published books returned first

SELECT DISTINCT ?book ?isbn ?title ?year WHERE {

  #Match all books with Lewis as an author
  ?book dct:creator <>;

	bibo:isbn10 ?isbn;
        dct:title ?title;
        #match the publication event
        blt:publication ?publication.

  #match the time of the publication event
  ?publication event:time ?time.
  #match the label of the year
  ?time rdfs:label ?year          

#order by descending year, after casting year as an integer
ORDER BY DESC( xsd:integer(?year) )

This retrieves the URI for the book, the ISBN, the title and the year of publication.

Sample query no. 5

Find 50 books published in a particular place, e.g. York

SELECT ?book ?isbn ?title WHERE {
  ?place rdfs:label "York" .
  ?publication event:place ?place.
        blt:publication ?publication;
        bibo:isbn10 ?isbn;
        dct:title ?title.

This retrieves the URI for the book, the ISBN and the title.

Note: This query will retrieve duplicates as there are duplicate triples (in this particular case, two triples with rdfs:label "York" - one in the book graph and one in the serials graph) in the triplestore. To obtain de-duplicated results, either change the query to SELECT DISTINCT or query the book graph separately.