Semantic Search the US Library of Congress

As the national Library of the United States, the Library of Congress has created vast amounts of metadata to describe books and other documents in its collection. Among this metadata is the Library of Congress Subject Headings (LCSH), a "controlled vocabulary" for classifying documents by subject. In order words, experts at the Library of Congress have come up with a (large) list of subject headers from which catalogers of documents can choose. As an example, if you look at the Library of Congress record for Tim Berners-Lee's book Weaving the Web, you'll that it is classified under "World Wide Web", specifically "World Wide Web--History".

Update: The website hosting the LCSH API appears to no longer make the API available.

Since the Library of Congress isn't the only entity that classifies documents, you can imagine that other entities (and not just libraries) would interested in reusing the LCSH vocabulary. But how should the Library of Congress make LCSH available so that it can be easily reused?

That's where the recent release of comes in (see also the ProgrammableWeb Profile):

This is an experimental service that makes the Library of Congress Subject Headings available as linked-data using the SKOS vocabulary. The goal of is to encourage experimentation and use of LCSH on the web with the hopes of informing a similar effort at the Library of Congress to make a continually updated version available. More information about the Linked Data effort can be found on the W3C Wiki.

Let's look at what you can do with through a couple of examples. First, we return to the subject heading World Wide Web, this time accessible from as

Note the form of the URL:{lccn} where lccn refers to the Library of Congress Control Number (LCCN), an identifier of the subject heading. In this case, the LCCN for World Wide Web is sh95000541.

If you drop this URL into your browser, you'll get the default format or representation of the information has about the World Wide Web subject header, including:

  • broader terms (e.g., Hypertext systems)
  • narrower terms (e.g., Semantic Web)
  • related terms (e.g., Internet)
  • alternative label -- (e.g, W3 (World Wide Web))

The diagram below illustrates some of these relationships


To facilitate reuse of the data, offers its data a variety of formats that can be accessed via content negotiation. That is, you use the Accept HTTP header to specify which of the following content type you want:

  • XHTML (with embedded RDFa), which is the default value (application/xhtml+ XML)
  • JSON (application/json)
  • RDF/XML (application/rdf+xml)
  • N3 (text/n3)

For example, you can use curl to get JSON representation of the World Wide Web subject header:

CURL -v -L -H "Accept: application/json"

By looking at the RDF/XML and N3 representations, you can see a concrete example of semantic web approaches to express notions of broader, narrower, and related terms as well as alternative labels using

  • Simple Knowledge Organization System (SKOS), which is "a model for expressing the basic structure and content of concept schemes such as thesauri, classification schemes, subject heading lists, taxonomies, folksonomies, and other types of controlled vocabulary"
  • designs rules for linked data to represent the network of interconnected subject headings

This experimental but promising service may soon pave the way for full production level web services from the Library of Congress.

Be sure to read the next Government article: Should Obama and McCain Have APIs?