Skip to content

Connecting to Library of Congress (LOC)

E. Lynette Rayle edited this page Mar 7, 2019 · 2 revisions

Overview

Library of Congres (LOC) already provides a REST API to query their headings. QA provides a wrapper around this to augment its functionality and refine it so that it is congruent with the other authorities in QA. For example, searching subject headings from LOC uses the subjects sub-authority.

Prerequisites

No additional setup required.

Accessing via QA

Authority loc

Subauthorities

  • for search: Subauthorities include authorities, vocabularies, datatypes, and preservation as defined in loc_subauthorities.rb.
  • for term: Subauthorities include only the authorities listed in loc_subauthorities.rb.

NOTE: The linked data module for QA also provides access to LOC authorities. It returns additional data including the URI for terms. See Using-the-Linked-Data-module-to-access-authorities for more information.


Example search queries

Example search subauthority subjects:

/qa/search/loc/subjects?q=History--

Result:

[
    {"id":"info:lc/authorities/subjects/sh2008121753","label":"History--Philosophy--History--20th century"},
    {"id":"info:lc/authorities/subjects/sh2008121752","label":"History--Philosophy--History--19th century"},
    etc...
]    

NOTE: The qa request is converted to the following LOC request. This is for information only. You do not need to know this to use QA.

http://id.loc.gov/search/?format=json&q=History--&q=cs:http://id.loc.gov/authorities/subjects

Example search subauthority countries:

/qa/search/loc/countries?q=france

Result:

[
    {"id":"info:lc/vocabulary/countries/fr","label":"France"},
    {"id":"info:lc/vocabulary/countries/st","label":"Saint-Martin"}
]    

NOTE: The qa request is converted to the following LOC request. This is for information only. You do not need to know this to use QA.

http://id.loc.gov/search/?format=json&q=france&q=cs:http://id.loc.gov/vocabulary/countries

Example term fetch request

Example fetch from subauthority subjects:

/qa/show/loc/subjects/sh2008121753

# NOT SUPPORTED
/qa/show/loc/countries/fr

Result:

[
  {"@id":"_:b63idlocgovauthoritiessubjectssh2008121753",
   "@type":["http://id.loc.gov/ontologies/RecordInfo#RecordInfo"],
   "http://id.loc.gov/ontologies/RecordInfo#recordChangeDate":[{"@type":"http://www.w3.org/2001/XMLSchema#dateTime","@value":"2008-04-26T08:08:05"}],
   "http://id.loc.gov/ontologies/RecordInfo#recordStatus":[{"@type":"http://www.w3.org/2001/XMLSchema#string","@value":"revised"}],
   "http://id.loc.gov/ontologies/RecordInfo#recordContentSource":[{"@id":"http://id.loc.gov/vocabulary/organizations/dlc"}],
   etc.
]

Example list all terms

Not supported


Documentation

LOC documents their API at... Techcenter -> Searching

Clone this wiki locally