Skip to content

gbv/jskos2marc

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

jskos2marc

Software License Build Status

Convert JSKOS authority records to MARC21

Table of Contents

Background

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.

Install

Just copy file src/jskos2marc.php where needed.

Requires PHP 7 (but might work on PHP 5.6 as well).

Usage

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 ...

API

The following PHP functions are defined in the JSKOS namespace:

jskos2marc

Convert an array of JSKOS objects to an array of MARC objects (encoded like MARC JSON).

jskos2marcjson

Convert an array of JSKOS objects to a MARC JSON string.

jskos2marcxml

Convert an array of JSKOS objects to a MARC XML string.

marcxml

Convert an MARC JSON record to a MARC XML string.

jskos_decode

Decode a JSON string into an array of JSKOS objects.

License

MIT

About

Convert JSKOS authority records to MARC21

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages