Documentation
¶
Overview ¶
Package unimarc reads UNIMARC bibliographic records and maps them to the MARC 21 model (the codex.Record), so a UNIMARC record flows through every libcodex exporter (mods, dublincore, citation, bibframe, schemaorg).
UNIMARC shares the ISO 2709 physical structure with MARC 21 but differs in two ways this package handles:
- The data dictionary: different tag semantics (title is 200, ISBN is 010, authors are 700/701/710, …). Title, Authors and friends interpret the common UNIMARC fields, and ToMARC21 re-tags a record to MARC 21.
- The character set is declared in field 100 positions 26-33 (up to four two-character graphic-set codes), not the leader. The reader triggers ISO 5426 transcoding when the extended-Latin code "03" appears in any slot, leaves UTF-8 ("50") and base Latin ("01") untouched, and best-effort decodes the unsupported Cyrillic/Greek sets while flagging them via Reader.Lossy.
Index ¶
- func Authors(r *codex.Record) []string
- func Decode(raw []byte) (*codex.Record, error)
- func Edition(r *codex.Record) string
- func ISBN(r *codex.Record) []string
- func ISSN(r *codex.Record) []string
- func Language(r *codex.Record) string
- func PublicationDate(r *codex.Record) string
- func Publisher(r *codex.Record) string
- func ReadFile(path string) ([]*codex.Record, error)
- func Subjects(r *codex.Record) []string
- func Title(r *codex.Record) string
- func ToMARC21(r *codex.Record) *codex.Record
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authors ¶
func Authors(r *codex.Record) []string
Authors returns the personal and corporate names with intellectual responsibility (UNIMARC 700/701/702 personal, 710/711/712 corporate) in a single pass over the record's fields.
func Decode ¶
Decode parses one UNIMARC record from its raw ISO 2709 bytes, transcoding values to UTF-8 according to the character set declared in field 100. Decode does not modify raw.
func Edition ¶
func Edition(r *codex.Record) string
Edition returns the edition statement (UNIMARC 205 $a).
func Language ¶
func Language(r *codex.Record) string
Language returns the language of the text (UNIMARC 101 $a), or "".
func PublicationDate ¶
func PublicationDate(r *codex.Record) string
PublicationDate returns the date of publication (UNIMARC 210 $d, or 214 $d).
func Publisher ¶
func Publisher(r *codex.Record) string
Publisher returns the publisher name (UNIMARC 210 $c, or the newer 214 $c).
func Subjects ¶
func Subjects(r *codex.Record) []string
Subjects returns the subject access points (UNIMARC 600/601 names used as subjects, 606 topical, 607 geographic, 608 form/genre) in a single pass over the record's fields.
func Title ¶
func Title(r *codex.Record) string
Title returns the title proper and other title information (UNIMARC 200 $a $e).
func ToMARC21 ¶
func ToMARC21(r *codex.Record) *codex.Record
ToMARC21 re-tags a UNIMARC record to the MARC 21 model, mapping the common fields so the record can be fed to any libcodex exporter. The mapping covers title, statement of responsibility, edition, publication, physical description, series, notes, subjects, names and identifiers; UNIMARC fields outside that set are dropped. Values are cleaned of UNIMARC's non-sort control characters.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader streams UNIMARC records from an ISO 2709 byte stream.
func (*Reader) All ¶
All returns an iterator over the records in the stream, stopping at the first error.