2017 © Pedro PelĂĄez
 

library simplemarcparser

A simple MARC21/XML parser

image

scriptotek/simplemarcparser

A simple MARC21/XML parser

  • Sunday, July 2, 2017
  • by danmichaelo
  • Repository
  • 5 Watchers
  • 7 Stars
  • 455 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 16 Versions
  • 2 % Grown

The README.md

SimpleMarcParser

Build Status Coverage Status Code Quality StyleCI Latest Stable Version Total Downloads, (*1)

SimpleMarcParser is currently a minimal MARC21/XML parser for use with QuiteSimpleXMLElement, with support for the MARC21 Bibliographic, Authority and Holdings formats., (*2)

Note: This project is not actively developed anymore, but I will still process issues. The aim of this project was to produce “simple” JSON representations of MARC21 records. I'm now working on php-marc, a wrapper for File_MARC., (*3)

Example:

require_once('vendor/autoload.php');

use Danmichaelo\QuiteSimpleXMLElement\QuiteSimpleXMLElement,
    Scriptotek\SimpleMarcParser\Parser;

$data = file_get_contents('http://sru.bibsys.no/search/biblio?' . http_build_query(array(
    'version' => '1.2',
    'operation' => 'searchRetrieve',
    'recordSchema' => 'marcxchange',
    'query' => 'bs.isbn="0-521-43291-x"'
)));

$doc = new QuiteSimpleXMLElement($data);
$doc->registerXPathNamespaces(array(
        'srw' => 'http://www.loc.gov/zing/srw/',
        'marc' => 'http://www.loc.gov/MARC21/slim',
        'd' => 'http://www.loc.gov/zing/srw/diagnostic/'
    ));

$parser = new Parser();

$record = $parser->parse($doc->first('/srw:searchRetrieveResponse/srw:records/srw:record/srw:recordData/marc:record'));

print $record->title;

foreach ($record->subjects as $subject) {
    print $subject['term'] . '(' . $subject['system'] . ')';
}

Transformation/normalization

This parser is aimed at producing machine actionable output, and does some non-reversible transformations to achieve this. Transformation rules expect AACR2-like records, and are tested mainly against the Norwegian version of AACR2 (Norske katalogregler), but might work well with other editions as well., (*4)

Examples:, (*5)

  • title is a combination of 300 $a and $b, separated by :.
  • year is an integer extracted from 260 $c by extracting the first four digit integer found (c2013 → 2013, 2009 [i.e. 2008] → 2009 (this might be a bit rough…))
  • pages is an integer extracted from 300 $a. The raw value, useful for e.g. non-verbal content, is stored in extent
  • creators[].name are transformed from ', ' to ' '

Form and material

Form and material is encoded in the leader and in control fields 006, 007 and 008. Encoding this information in a format that makes sense is a work-in-progress., (*6)

Electronic and printed material is currently distinguished using the boolean valued electronic key., (*7)

Printed book:, (*8)

{
    "material": "book",
    "electronic": false
}

Electronic book:, (*9)

{
    "material": "book",
    "electronic": true
}

The Versions

02/07 2017

dev-master

9999999-dev

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

02/07 2017

v0.9.1

0.9.1.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

02/07 2017

v0.9.0

0.9.0.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

11/12 2016

v0.8.1

0.8.1.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

21/09 2016

v0.8.0

0.8.0.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

12/07 2015

v0.7.0

0.7.0.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

06/07 2015

v0.6.4

0.6.4.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

15/03 2015

v0.6.3

0.6.3.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

21/10 2014

v0.6.2

0.6.2.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

09/07 2014

v0.6.1

0.6.1.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

05/07 2014

v0.6.0

0.6.0.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

04/07 2014

v0.5.3

0.5.3.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

31/05 2014

v0.5.2

0.5.2.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

26/03 2014

0.4.1

0.4.1.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

24/11 2013

0.3.1

0.3.1.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc

09/11 2013

0.2.0

0.2.0.0

A simple MARC21/XML parser

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

marc