Documentation
¶
Overview ¶
Package mods converts MARC 21 records to MODS (Metadata Object Description Schema), the Library of Congress XML standard that is richer than MARCXML and near-lossless from MARC.
MODS is a different data model than MARC — titleInfo, name, originInfo, subject, … — so this is a one-way mapping (a crosswalk following the LoC MARC-to-MODS mapping), not a codex.RecordReader. The Writer does implement codex.RecordWriter, so it plugs into codex.Convert as a conversion target:
w := mods.NewWriter(out) codex.Convert(iso2709.NewReader(src), w) w.Close()
The crosswalk covers the common fields (title, names, type, origin, physical description, subjects, identifiers, language, notes, record info); fields and subfields outside that set are not carried.
Index ¶
- Constants
- func Encode(r *codex.Record) ([]byte, error)
- func WriteFile(path string, records []*codex.Record) error
- type Identifier
- type Language
- type LanguageTerm
- type MODS
- type Name
- type NamePart
- type Note
- type OriginInfo
- type Physical
- type Place
- type PlaceTerm
- type RecordInfo
- type Role
- type RoleTerm
- type Subject
- type TitleInfo
- type Writer
Constants ¶
const Namespace = "http://www.loc.gov/mods/v3"
Namespace is the MODS version 3 namespace.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Identifier ¶
type Language ¶
type Language struct {
LanguageTerm LanguageTerm `xml:"languageTerm"`
}
type LanguageTerm ¶
type MODS ¶
type MODS struct {
XMLName xml.Name `xml:"mods"`
Xmlns string `xml:"xmlns,attr,omitempty"`
Version string `xml:"version,attr,omitempty"`
TitleInfo []TitleInfo `xml:"titleInfo"`
Name []Name `xml:"name"`
TypeOfResource string `xml:"typeOfResource,omitempty"`
OriginInfo *OriginInfo `xml:"originInfo,omitempty"`
Language []Language `xml:"language"`
PhysicalDesc *Physical `xml:"physicalDescription,omitempty"`
Note []Note `xml:"note"`
Subject []Subject `xml:"subject"`
Identifier []Identifier `xml:"identifier"`
RecordInfo *RecordInfo `xml:"recordInfo,omitempty"`
}
MODS is a <mods> record. Empty fields are omitted from the output.
func FromRecord ¶
func FromRecord(r *codex.Record) *MODS
FromRecord maps a MARC record to MODS following the common-field crosswalk. It makes a single pass over the fields, dispatching by tag.
type OriginInfo ¶
type RecordInfo ¶
type RecordInfo struct {
RecordIdentifier string `xml:"recordIdentifier,omitempty"`
}
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer converts records and writes them into a <modsCollection>. Close must be called to emit the closing tag.