Convert JSKOS authority records to MARC21
This library provides conversion from JSKOS format to MARC 21 Authority format.
See mc2skos for the reverse conversion.
See also jskos-tools for a similar library in JavaScript.
Just copy file src/jskos2marc.php
where needed.
Requires PHP 7 (but might work on PHP 5.6 as well).
See API section below for details to use in PHP source code:
require_once 'src/jskos2marc.php';
$jskos = [ [ 'prefLabel' => [ 'de' => 'Test' ] ] ];
if ($format === 'marcxml') {
header('Content-Type: application/xml; charset=utf-8');
echo JSKOS\jskos2marcxml($jskos);
} else if ($format === 'marcjson') {
header("Content-type: application/json; charset=utf-8");
echo JSKOS\jskos2marcjson($jskos);
}
See script bin/jskos2marc
to convert JSKOS to MARC from command line:
./bin/jskos2marc $URL $FILENAME ...
The following PHP functions are defined in the JSKOS
namespace:
Convert an array of JSKOS objects to an array of MARC objects (encoded like MARC JSON).
Convert an array of JSKOS objects to a MARC JSON string.
Convert an array of JSKOS objects to a MARC XML string.
Convert an MARC JSON record to a MARC XML string.
Decode a JSON string into an array of JSKOS objects.
MIT