Documentation
¶
Overview ¶
Package dublincore converts MARC 21 records to Dublin Core (DCMI), the lowest-common-denominator metadata used by OAI-PMH and most repository software. It emits the OAI oai_dc XML form and a DC-in-JSON form.
Dublin Core is a different, flat and lossy model (15 repeatable elements), so this is a one-way MARC->DC crosswalk, not a codec. The Writers implement codex.RecordWriter, so they plug into codex.Convert as conversion targets:
w := dublincore.NewWriter(out) // oai_dc XML; or NewJSONWriter for DC-JSON codex.Convert(iso2709.NewReader(src), w) w.Close()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeJSON ¶
EncodeJSON converts a record to a compact Dublin Core JSON object.
Types ¶
type DC ¶
type DC struct {
Title []string
Creator []string
Subject []string
Description []string
Publisher []string
Contributor []string
Date []string
Type []string
Format []string
Identifier []string
Source []string
Language []string
Relation []string
Coverage []string
Rights []string
}
DC holds the fifteen Dublin Core elements, each repeatable.
func FromRecord ¶
func FromRecord(r *codex.Record) *DC
FromRecord maps a MARC record to Dublin Core in a single pass over the fields.
type JSONWriter ¶
type JSONWriter struct {
// contains filtered or unexported fields
}
JSONWriter converts records and writes them as a JSON array of DC objects.
func NewJSONWriter ¶
func NewJSONWriter(w io.Writer) *JSONWriter
NewJSONWriter returns a Writer that writes a JSON array of Dublin Core objects.
func (*JSONWriter) Close ¶
func (wr *JSONWriter) Close() error
func (*JSONWriter) Write ¶
func (wr *JSONWriter) Write(r *codex.Record) error