RDFa with schema.org codelab: Book - external descriptions

By Dan Scott,

About this codelab

In this codelab, you're going to link your catalogue record to other descriptions on the web. You will use the schema.org vocabulary and express it via RDFa attributes.

Audience: Beginner

Prerequisites: To complete this codelab, you will need a basic familiarity with HTML. The exercises can be found in codelab.zip, with the solutions found in the rdfa_exercises subdirectory. There are frequent checkpoints through the code lab, so if you get stuck at any point, you can use the checkpoint file to resume and work through this codelab at your own pace.

Continue working with the HTML file that you have been editing so far, or for a fresh start, copy ../1_book/step4/check_f.html into a new file.

Linking to other bibliographic descriptions

We have already seen that entities such as authors and subject headings often have other representations on the web to which we can connect our own

Linking to OCLC Bibliographic Work Descriptions

OCLC recently announced that it had published 197 million open bibliographic work descriptions.

  1. Search for the corresponding book at worldcat.org; the ISBN is a good entry point.
  2. Scroll down to the Linked Data section of the WorldCat details page and click on the + to display the contents.
  3. Find the schema:exampleOfWork property and find the link to the OCLC Work Entity. The link redirects to an experimental URL, but you can copy and paste the link into your book record. You can also find the non-experimental URL at the top of the Work Description page. Aside: exampleOfWork has been proposed as a schema.org extension, but has not yet been accepted.
  4. Use a sameAs property to link your book to the OCLC Work Description.
Check your markup
<!DOCTYPE html>
...
<body vocab="http://schema.org/" typeof="Book" resource="#book">
  <link property="sameAs" href="http://worldcat.org/entity/work/id/291035169">
...

Linking to Freebase editions

Freebase is a source of linked open data that uses its own schema to represent entities, including books to which specific editions are attached in a quasi-FRBR fashion.

  1. Search for the corresponding book edition at freebase.com. Unfortunately, for this book you won't currently find an entry in Freebase. Due to the very low level of quality of bibliographic metadata they had originally loaded, in 2013 Freebase deleted a vast number of book entities from their database. For this exercise, you can try finding one of your favourite books; if all else fails, search for ISBN13 9780545522458 to retrieve the book Blood Ties.
  2. The resulting URL http://www.freebase.com/m/01069fkb is a human-readable representation. If you read the Freebase documentation, you will eventually find that you can link to a machine-readable RDF representation by taking the Freebase topic ID (m/01069fkb) and appending it to https://www.googleapis.com/freebase/v1/rdf/.
  3. Use a sameAs property to link your book to the Freebase edition.
Check your markup
<!DOCTYPE html>
...
<body vocab="http://schema.org/" typeof="Book" resource="#book">
  <link property="sameAs" href="http://worldcat.org/entity/work/id/291035169">
  <link property="sameAs" href="https://www.googleapis.com/freebase/v1/rdf/m/01069fkb">
...

Linking to OpenLibrary descriptions

OpenLibrary, effectively a wiki page for every book, offers RDF data for all of the books and authors in its collection, and offers over 1,000,000 free ebook titles in its classic collection.

  1. Search for the corresponding book at openlibrary.org; the ISBN is a good entry point.
  2. The resulting page has a URL of https://openlibrary.org/books/OL12811177M/Data. Following the documentation for the OpenLibrary Restful API, use a sameAs property to link your book to the machine-readable OpenLibrary URL of https://openlibrary.org/books/OL12811177M.
Check your markup
<!DOCTYPE html>
...
<body vocab="http://schema.org/" typeof="Book" resource="#book">
  <link property="sameAs" href="http://worldcat.org/entity/work/id/291035169">
  <link property="sameAs" href="https://www.googleapis.com/freebase/v1/rdf/m/01069fkb">
  <link property="sameAs" href="https://openlibrary.org/books/OL12811177M">
...

Linking to publisher descriptions

You can also link to the publisher's description. Even though the publisher might not offer any linked data themselves, it might serve as a useful identifier for the machines.

Once again, you can use the sameAs property to link your book to the publisher's description.

Check your markup
<!DOCTYPE html>
...
<body vocab="http://schema.org/" typeof="Book" resource="#book">
  <link property="sameAs" href="http://worldcat.org/entity/work/id/291035169">
  <link property="sameAs" href="https://www.googleapis.com/freebase/v1/rdf/m/01069fkb">
  <link property="sameAs" href="https://openlibrary.org/books/OL12811177M">
  <link property="sameAs" href="http://www.springer.com/statistics/book/978-1-4612-9563-1">
...

Checkpoint: Your original HTML page should now look like ../1_book/step4/check_g.html.

Lessons learned

In this exercise, you learned how to link your bibliographic description to the bibliographic descriptions available from Freebase, OCLC, and publishers, as a means of giving machines more entry points into linked open data.

Next codelab: Library holdings

About the author

Dan Scott is a systems librarian at Laurentian University.

Informational resources

  • RDFa Lite (W3C Recommendation) - a marvel of technical writing, this is a specification written as a concise, extremely useful tutorial
  • schema.org - the source for the vocabulary types and definitions, although the examples all use microdata or JSON-LD instead of RDFa Lite
  • RDFa Primer (W3C Working Group Note) - a more in-depth RDFa tutorial that covers properties beyond RDFa Lite; the additional examples may help clarify how RDFa Lite works (really, you don't need anything beyond RDFa Lite!)
  • Heath, Tom; Bizer, Christian. Linked data: Evolving the Web into a Global Space - a book (freely available on the web) that goes into depth to cover the principles, patterns, and best practices for publishing linked data on the web

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.