Library of Congress Authorities Linker

The bibcat.linker.loc submodule is provides an API wrapper around the Library of Congress search service that we try to link out to external Library of Congress authoritative name and subject IRIs for local IRIs and blank nodes.

>>> import bibcat.linkers.loc as loc
>>> loc
<module 'bibcat.linkers.loc' from '/Users/jeremynelson/2017/bibcat/bibcat/linkers/'>

We will test the loc.link_term function that takes a term and searches all of the Library of Congress available data sets. Much like the functions in the base bibcat module, the loc.link_term is a more primitive function that is meant to used in application workflows.

Using the original Library of Congress RDF Graph, we'll create a for loop and iterate through all of the bf:Agent entities and run the loc.link_term to see what the top result is for each term.

>>> for agent in pp4_loc.subjects(predicate=rdflib.RDF.type,
    label = pp4_loc.value(subject=agent,
    if label is not None:
        print("Original label: {}".format(label))
        result = loc.link_term(str(label))
        for row in result:
            print("\tIRI: {}\n\ttitle {}\n".format(row.get('iri'),

Original label: DLC
    title DLC eng rda DLC

Original label: ZMM
    title ZMM-GT Coordinating Secretariat

Original label: C. Scribner's sons
    title Charles Scribner's Sons

Original label: ZMM
    title ZMM-GT Coordinating Secretariat

Original label: Howells, William Dean, 1837-1920.
    title Howells, William Dean, 1837-1920. Novels. Selections

Original label: Austen, Jane, 1775-1817.
    title Austen, Jane, 1775-1817. Novels


Original contented Copyrighted © 2017 by Jeremy Nelson and KnowledgeLinks under Creative Commons License, Source code repository licensed under the Apache 2 and available on Github.