Skip to content

LD4P related Browse Changes

Christina Cortland edited this page Feb 2, 2024 · 8 revisions

LD4P-related Browse Changes

Author, Author-Title, and Subject browse pages may display supplemental data sourced from the LOC Linked Data Service, Wikidata and DBpedia.

Examples:

The code that implements this linked data display was adapted from work produced by the Linked Data for Production (LD4P) project.

Overview

To display Wikidata and DBpedia data on our author, subject, and author-title browse pages:

  1. Match the browse heading to a Library of Congress heading via the id.loc.gov linked data suggest service
    • This is currently done via AJAX for Author-Title headings, and in the BrowseController for Author and Subject headings.
  2. Via AJAX, query the Wikidata SPARQL endpoint for a Wikidata entity with the previously fetched LOC heading
  3. For Author and Subject browse pages, additionally query via AJAX the DBpedia SPARQL endpoint for a DBpedia entity with the previously fetched Wikidata entity id and label.
  4. Unless the heading or property is included in the linked data exclusion list, display any fetched properties with attribution links and image citations.
  5. For Author and Subject browse pages, additionally query via AJAX the LC Name Authority File (LCNAF) or LC Subject Headings (LCSH) for the LOC heading's LC Classification values. If found, display this value with a link to "Browse related items by call number".

Author-Title Headings

For items in the catalog that are associated with one and only one author-title heading, we fetch and display info for that heading directly on the item record via AJAX.

Example: A midsummer night's dream

Additional js allows users to differentiate data sourced from Wikidata vs the catalog Solr index by toggling text background color.

Data Exclusions

Individual author or subject headings can be added to a linked data exclusion list so that data is not fetched from Wikidata or DBpedia for that heading.

Exclusions can work at a macro level, meaning no external data at all is retrieved for a given author or subject; or it can work at a micro level, i.e. do not include a specific property for a given author or subject. The public/excludeEntities.yml file contains detailed comments on how the file needs to be structured.

An additional route was also created to view linked data exclusions for any author or subject heading. Example: https://catalog.library.cornell.edu/check_permissions?key=Dickens,%20Charles,%201812-1870.

This linked data exclusion functionality is not yet available for author-title headings.

Code

The bulk of the linked data browse code is found:

  • JS:
    • app/assets/javascripts/linked_data/
    • app/assets/javascripts/retrieve_lcsh.js
  • Controller:
    • app/controllers/browse_controller.rb
  • Views:
    • app/views/browse/_author_info.html.erb
    • app/views/browse/_author_title_info.html.erb
    • app/views/browse/_subject_info.html.erb

Entity exclusion code:

  • public/excludeEntities.yml
  • app/controllers/handle_external_data_controller.rb
  • app/helpers/external_data_helper.rb
  • app/views/browse/_author_info.html.erb
  • app/views/browse/_subject_info.html.erb