skip navigation
  • Ask a LibrarianDigital CollectionsLibrary Catalogs
  •    Options
The Library of Congress  >  Authorities & Vocabularies  >  Technical Center  >  Downloads
Authorities and Vocabularies
  • Authorities & Vocabularies
  • About
  • Technical Center
  • Search & Download
  • Contact Us

Downloads

Technical Center:  Downloads | Metadata | Searching/Querying | Serializations

Downloads

Bulk downloads are available from the main Authorities and Vocabularies search page. There are compressed files for both RDF/XML and N-Triples serializations, both containing the entirety of the Subject Headings data at present.

Downloads for individual concepts or headings are possible by:

  1. Using a conventional, graphical web browser when viewing a concept or heading of interest. Links are provided to enable a download.
  2. Rendering the XHTML source for a given concept or heading through a RDFa-aware processing tool, such as the RDFa Distiller Offsite link offered by the W3C. For example, "Bahia grass", when processed by the RDFa distiller, yields this result.
  3. Using a non-graphical user agent via the URIs assigned to the Concepts and ConceptSchemes. Examples include command-line tools like cURL Offsite link and wget Offsite link. Other alternatives include user agent libraries specific to programming languages. e.g., Perl: LWP::UserAgent Offsite link, Java: HttpClient Offsite link, Python: httplib Offsite link, etc.

The non-graphical approach is advantageous, and represents the main design principle for the Authorities and Vocabularies service. It allows programmatic access through machine-readable scripting instead of requiring human interaction. Using this method, it is possible to use HTTP content negotiation Offsite link over a single URI to obtain a concept or heading, and to optionally serialize it in a variety of formats. This is achieved through use of the HTTP request header called "Accept". When used on a request with the MIME type of interest, the server response will send the desired format back to satisfy the request. See the supported MIME types and serializations page for more information.

Some command-line usage examples include:

cURL

This will download the LC Subject Heading for "ActionScript (Computer program language)" in the JSON serialization.

  • curl -H 'Accept: application/json' http://id.loc.gov/authorities/sh00000011
wget

This will download the LC Subject Heading for "ActionScript (Computer program language)" in the RDF/XML serialization.

  • wget -S -d 'http://id.loc.gov/authorities/sh00000011' \
    --header="Accept: application/rdf+xml"

Extracting labels from HTTP response headers

It is possible to determine the preferred label for a given concept or heading of interest without necessarily needing to download the entire RDF content. Requesting a concept URI with a HTTP HEAD method exposes a private header called "X-PrefLabel", that is a URL-encoded representation of the preferred label.

For example, running cURL with the "-I" argument on the URI for "Bahia grass" performs a HTTP request using the HEAD method.

  • curl -I http://id.loc.gov/authorities/sh93007391

HTTP HEAD requests return the HTTP response only, sans the body of the RDF or XHTML content. Among these headers, one would see a given header "X-PrefLabel: Bahia%20grass". It is possible to use a HTTP library within the programming language of your choice to access this header. URL-decoding the value of the X-PrefLabel header yields the string "Bahia grass".

Why use dereferenceable URIs?

Having a dereferenceable URI for these Concepts -- and the ConceptSchemes to which they belong -- greatly enhances the ability to provide web services for consumers of our standards, whether working in XML, or in another technology.

When building a web service, you need dereferenceable URIs to use the service. This URI might as well represent the data you are aiming to use. Although you could use non-dereferenceable URIs in conjunction with dereferenceable Handles Offsite link or the like, it is unnecessary weight to manage. Handles, etc., are not always needed for URIs under your own control. This holds true if you have the ability to rewrite URIs at the server level as data location changes over time, and build with the notion of content negotiation over RESTful URIs from the start.

Disclaimer

About | Press | Site Map | Contact | Accessibility | Legal | USA.gov