Format Support¶
MRRC supports multiple serialization formats for MARC records. This page provides a comprehensive reference of all supported formats.
Format Matrix¶
| Format | Read | Write | Python | Rust | Notes |
|---|---|---|---|---|---|
| ISO 2709 | Yes | Yes | Yes | Yes | Standard MARC binary interchange |
| JSON | Yes | Yes | Yes | Yes | Generic JSON representation |
| MARCJSON | Yes | Yes | Yes | Yes | LOC standard JSON-LD format |
| MARCXML | Yes | Yes | Yes | Yes | MARC21 XML schema |
| CSV | - | Yes | Yes | Yes | Tabular export |
| Dublin Core | - | Yes | Yes | Yes | 15-element metadata |
| MODS | Yes | Yes | Yes | Yes | Metadata Object Description Schema |
| BIBFRAME | Yes | Yes | Yes | Yes | RDF/Linked Data (bidirectional) |
All formats are available in both Python and Rust without feature flags.
Format Details¶
ISO 2709 (MARC Binary)¶
The standard interchange format for MARC records.
File extension: .mrc
Use cases:
- Library system interchange (ILS, OCLC)
- Z39.50 compatible systems
- Maximum compatibility
Python:
from mrrc import MARCReader, MARCWriter
# Reading
for record in MARCReader("records.mrc"):
print(record.title())
# Writing
with MARCWriter("output.mrc") as writer:
writer.write(record)
Rust:
use mrrc::{MarcReader, MarcWriter};
use std::fs::File;
// Reading
let mut reader = MarcReader::new(File::open("records.mrc")?);
while let Some(record) = reader.read_record()? {
println!("{:?}", record.title());
}
// Writing
let mut writer = MarcWriter::new(File::create("output.mrc")?);
writer.write_record(&record)?;
JSON¶
Generic JSON representation of MARC records.
Python:
MARCJSON¶
Library of Congress standard JSON format for MARC.
Python:
MARCXML¶
MARCXML representation following the MARC21 XML schema.
Python:
xml_str = record.to_xml()
# Parse a single record from MARCXML
record = mrrc.xml_to_record(xml_str)
# Parse a MARCXML collection (multiple records)
records = mrrc.xml_to_records(collection_xml_str)
CSV¶
Tabular export for spreadsheet applications.
Python:
Dublin Core¶
Simplified 15-element metadata schema.
Python:
MODS¶
Metadata Object Description Schema for detailed bibliographic metadata.
Python:
BIBFRAME¶
BIBFRAME 2.0 RDF output for linked data applications.
Python:
from mrrc import marc_to_bibframe, BibframeConfig, RdfFormat
config = BibframeConfig()
config.set_base_uri("http://example.org/")
rdf_graph = marc_to_bibframe(record, config)
turtle_str = rdf_graph.serialize("turtle")
See the BIBFRAME Conversion Guide for detailed usage.
See Also¶
- Format Selection Guide - Choosing the right format
- Working with Large Files - Large file handling