unimarc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 9 Imported by: 0

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-27, not the leader. The reader selects UTF-8 (code "50"), ISO 5426 (code "01"/"02") or a best-effort fallback accordingly, transcoding values to UTF-8.

Index

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).

func Decode

func Decode(raw []byte) (*codex.Record, error)

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.

func Edition

func Edition(r *codex.Record) string

Edition returns the edition statement (UNIMARC 205 $a).

func ISBN

func ISBN(r *codex.Record) []string

ISBN returns the ISBNs (UNIMARC 010 $a).

func ISSN

func ISSN(r *codex.Record) []string

ISSN returns the ISSNs (UNIMARC 011 $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 ReadFile

func ReadFile(path string) ([]*codex.Record, error)

ReadFile reads every UNIMARC record from the named file.

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).

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 NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a Reader over an ISO 2709 UNIMARC stream.

func (*Reader) All

func (rd *Reader) All() iter.Seq2[*codex.Record, error]

All returns an iterator over the records in the stream, stopping at the first error.

func (*Reader) Read

func (rd *Reader) Read() (*codex.Record, error)

Read returns the next record, or io.EOF at the end of the stream.

Jump to

Keyboard shortcuts

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