libraryofcongress

package module
v0.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

README

go-sfomuseum-libraryofcongress

Go package for working with Library of Congress data in an SFO Museum context.

Documentation

Go Reference

Example

For working example code have a look at:

Tools

lookup

For example:

$> ./bin/lookup -lookup-uri lcsh:// Airplanes
sh85002782 Airplanes

$> ./bin/lookup -lookup-uri lcnaf:// "Lindbergh, Charles A. (Charles Augustus), 1902-1974"
n79100565 Lindbergh, Charles A. (Charles Augustus), 1902-1974

A note about "lookups"

Please have a look at the A note about "lookup" documentation in the go-sfomuseum-airfield package. The issues outlined there are the same here. The "tl;dr" is:

It's not great. It's just what we're doing today. The goal right now is to expect a certain amount of "rinse and repeat" in the short term while aiming to make each cycle shorter than the last.

A note about the data

The data files in this package, and in particular the data/lcnaf.csv.bz2 file, are very big. As of this writing the data are loaded in to an in-memory sync.Map instance which means that a) it takes a non-zero amount of time to load b) consumes a non-trivial amount of memory. As such the lcnaf lookup table, derived from data which has 11M rows, only stores label -> ID pointers. It is not possible, at this time, to lookup the label for a given lcnaf identifier.

Remember: This package is tailored to SFO Museum's specific needs, and it's specific trade-offs, at the time of writing. As mentioned above "It's not great. It's just what we're doing today."

See also

Documentation

Overview

Package libraryofcongress provides methods for working with Library of Congress (LoC) metadata files in an SFO Museum context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterLookup

func RegisterLookup(ctx context.Context, scheme string, init_func LookupInitializationFunc) error

RegisterLookup() associates 'scheme' with 'init_func' in an internal list of avilable `Lookup` implementations.

Types

type Lookup

type Lookup interface {
	// Find() searches for a given LoC identifier.
	Find(context.Context, string) ([]interface{}, error)
	// Append() indexes a LoC record with one or more identifiers.
	Append(context.Context, interface{}) error
}

type Lookup provides an interface for indexing and search Library of Congress (LoC) identifiers.

func NewLookup

func NewLookup(ctx context.Context, uri string) (Lookup, error)

NewLookup() returns a new `Lookup` instance derived from 'uri'. The semantics of and requirements for 'uri' as specific to the package implementing the interface.

type LookupInitializationFunc

type LookupInitializationFunc func(ctx context.Context, uri string) (Lookup, error)

type LookupInitializeFunc is a function used to initialize an implementation of the `Lookup` interface.

Directories

Path Synopsis
cmd
Package cmd provides command line tools for working with Library of Congress (LoC) data.
Package cmd provides command line tools for working with Library of Congress (LoC) data.
Package data provides embedded Library of Congress (LoC) data files.
Package data provides embedded Library of Congress (LoC) data files.
Package lcnaf provides methods for working with Library of Congress Named Authority File (LCNAF) data.
Package lcnaf provides methods for working with Library of Congress Named Authority File (LCNAF) data.
Package lcsh provides methods for working with Library of Congress Subject Heading (LCSH) data.
Package lcsh provides methods for working with Library of Congress Subject Heading (LCSH) data.
Package sqlite provides methods for working with Library of Congress (LoC) data in an SFO Museum context.
Package sqlite provides methods for working with Library of Congress (LoC) data in an SFO Museum context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL