Documentation ¶
Overview ¶
Package lcsh provides methods for working with Library of Congress Subject Heading (LCSH) data.
Index ¶
- Constants
- func IsMultipleCandidates(e error) bool
- func IsNotFound(e error) bool
- func NewSubjectHeadingLookup(ctx context.Context, uri string) (libraryofcongress.Lookup, error)
- func NewSubjectHeadingLookupWithLookupFunc(ctx context.Context, lookup_func SubjectHeadingLookupFunc) (libraryofcongress.Lookup, error)
- func OpenData(ctx context.Context, uri string) (io.ReadCloser, error)
- type MultipleCandidates
- type NotFound
- type SubjectHeading
- type SubjectHeadingLookup
- type SubjectHeadingLookupFunc
Constants ¶
const DATA_GITHUB string = "https://github.com/sfomuseum/go-sfomuseum-libraryofcongress/raw/main/data/lcsh.csv.bz2"
DATA_GITHUB is the URL for the embedded LCSH data included with this package on GitHub.
const DATA_JSON string = "lcsh.csv.bz2"
DATA_JSON is the name of the embedded LCSH data included with this package.
Variables ¶
This section is empty.
Functions ¶
func IsMultipleCandidates ¶
IsMultipleCandidates returns a boolean value indicating whether 'e' is of type `MultipleCandidates`.
func IsNotFound ¶
IsNotFound returns a boolean value indicating whether 'e' is of type `NotFound`.
func NewSubjectHeadingLookup ¶
func NewSubjectHeadingLookupWithLookupFunc ¶
func NewSubjectHeadingLookupWithLookupFunc(ctx context.Context, lookup_func SubjectHeadingLookupFunc) (libraryofcongress.Lookup, error)
NewSubjectHeadingLookupWithLookupFunc will return an `lcsh.SubjectHeadingsLookup` instance derived by data compiled using `lookup_func`.
Types ¶
type MultipleCandidates ¶
type MultipleCandidates struct{ Code string }
type NotFound is a struct for representing LCSH identifiers that return multiple records.
func (MultipleCandidates) Error ¶
func (e MultipleCandidates) Error() string
Error() returns a stringified representation of 'e'.
func (MultipleCandidates) String ¶
func (e MultipleCandidates) String() string
String() returns a stringified representation of 'e'.
type NotFound ¶
type NotFound struct{ Code string }
type NotFound is a struct for representing missing LCSH records.
type SubjectHeading ¶
type SubjectHeading struct { // Id is the unique identifier for this LCSH record. Id string `json:"id"` // Label is the name (or title) for this LCSH record. Label string `json:"label"` }
SubjectHeading is a struct containing a subset of data for a LCSH record.
func (*SubjectHeading) String ¶ added in v0.0.2
func (sh *SubjectHeading) String() string
String() returns the a string-ified representation of the record's Id and Label properties.
type SubjectHeadingLookup ¶
type SubjectHeadingLookup struct {
libraryofcongress.Lookup
}
type SubjectHeadingLookupFunc ¶
func NewSubjectHeadingLookupFuncWithReader ¶
func NewSubjectHeadingLookupFuncWithReader(ctx context.Context, r io.ReadCloser) SubjectHeadingLookupFunc
NewSubjectHeadingLookup will return an `SubjectHeadingLookupFunc` function instance that, when invoked, will populate an `lcsh.SubjectHeadingsLookup` instance with data stored in `r`. `r` will be closed when the `SubjectHeadingLookupFunc` function instance is invoked. It is assumed that the data in `r` will be formatted in the same way as the procompiled (embedded) data stored in `data/sfomuseum.json`.