marcview

package
v0.229.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package marcview is the MARC half of the dual-view editor: it materializes a grain's records as an editable field array (via the framework-aware decode, so overrides shadow and verbatim sidecar fields appear), and writes an edited array back as a *diff* -- the edited record re-crosswalks to BIBFRAME, the result is compared to the original decode per (subject, predicate) group, and only the changed groups land as editorial quads with the override semantics. Untouched fields are byte-for-byte no-ops; crosswalk-lossy tags round-trip through the lcat:marcVerbatim sidecar instead of the graph.

Index

Constants

This section is empty.

Variables

View Source
var ErrValidation = errors.New("marcview: invalid record")

ErrValidation reports an edited record that cannot be saved.

Functions

func DocToRecord

func DocToRecord(doc RecordDoc) (*codex.Record, error)

DocToRecord rebuilds the full MARC record from a field array (every field included, lossy or not) -- the inverse of RecordToDoc.

func Save

func Save(grain []byte, index int, edited RecordDoc) ([]byte, error)

Save writes an edited record back onto the grain as an editorial diff and returns the updated grain (the input bytes unchanged when nothing changed). index addresses the record within View's order.

Types

type Field

type Field struct {
	Tag  string `json:"tag"`
	Ind1 string `json:"ind1,omitempty"`
	Ind2 string `json:"ind2,omitempty"`
	// Value carries a control field's raw data (tag < 010).
	Value     string     `json:"value,omitempty"`
	Subfields []Subfield `json:"subfields,omitempty"`
	// Lossy carries the fidelity table's reason when the tag does not
	// survive the crosswalk -- the editor's non-blocking warning. Edits to
	// lossy tags persist via the lcat:marcVerbatim sidecar.
	Lossy string `json:"lossy,omitempty"`
}

Field is one MARC field row of the editing grid.

type RecordDoc

type RecordDoc struct {
	// Node is the grain node the record maps to (its Instance IRI, or the
	// Work IRI for an instance-less record).
	Node   string  `json:"node"`
	Leader string  `json:"leader"`
	Fields []Field `json:"fields"`
}

RecordDoc is one materialized MARC record.

func RecordToDoc

func RecordToDoc(rec *codex.Record) RecordDoc

RecordToDoc materializes one parsed MARC record as a field array -- the copy-cataloging search results and staged imports speak this shape too .

func View

func View(grain []byte) ([]RecordDoc, error)

View materializes every record a grain carries.

func ViewSource added in v0.47.0

func ViewSource(grain []byte, org string) ([]RecordDoc, error)

ViewSource is View with the deployment's MARC organization code: each record's 040 derives from graph facts at decode time. Empty org decodes unchanged.

type Subfield

type Subfield struct {
	Code  string `json:"code"`
	Value string `json:"value"`
}

Subfield is one (code, value) pair of a data field.

Jump to

Keyboard shortcuts

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