node-inist-ark

NodeJS package used to handle "normalized" ARK for the INIST organization This library can be used to generate a lot of random and valid ARKs dedicated to a specific NAAN and subpublisher, or to parse an existing ARK as a nice JSON object, or to validate the content of a given ARK (ex: checking this ARK as not been misspelled thanks to its checksum).
All generated identifiers are conform to The ARK Identifier Scheme RFC
INIST's ARK anatomy is:
ark:/67375/39D-S2GXG1TW-8
\__/ \___/ \__/\______/\_/
| | | | |
ARK Label | | | Check sum (1 char)
| | Identifier (8 chars)
| Sub-publisher (3 chars, it has to be generated in the centralized INIST ARK registry)
|
Name Assigning Authority Number (NAAN) (67375 is dedicated for INIST)
- INIST NAAN will not change and is this integer: 67375
- Sub-publisher is handled by a [centralized ARK registry for INIST](todo add the link)
- Identifier is a string of 8 uppercase characters from this alphabet 0123456789BCDFGHJKLMNPQRSTVWXZ
- Check sum is 1 character calculated from the ARK identifier following the NCDA checksum algorithm. It is used to help detecting mispelled ARK.
Install
npm i inist-ark
Usage
Generate lot of ARKs
Notice that when generating an ARK, you must know the wanted subpublisher that you registred in the INIST's central ARK registry.
var InistArk = require('inist-ark');
var ark = new InistArk({ subpublisher: '4G1' });
ark.generate();
ark.generate();
var ark2 = new InistArk();
ark2.generate({ subpublisher: '39D' });
ark2.generate({ subpublisher: '015' });
ark2.generate({ subpublisher: '015' });
ark2.generate({ subpublisher: '015' });
ark2.generate({ subpublisher: '015' });
ark2.generate({ subpublisher: '015' });
Parse an ARK
var InistArk = require('inist-ark');
var ark = new InistArk();
ark.parse('ark:/67375/39D-S2GXG1TW-8');
ark.parse('ark:/67375/39D-L2-');
Validate an ARK
var InistArk = require('inist-ark');
var ark = new InistArk();
ark.validate('ark:/67375/39D-S2GXG1TW-8');
Checksum calculation is based on the NCDA algorithm
Generate an ARK without subpublisher
var InistArk = require('inist-ark');
var ark = new InistArk({
naan: 12345
subpublisher: false
});
ark.generate();
Generate an ARK without hyphen
var InistArk = require('inist-ark');
var ark = new InistArk({
naan: 12345,
subpublisher: 'XYZ',
hyphen: false,
});
ark.generate();
ark.generate({ subpublisher: false });
Constructor parameters
When creating a new InistArk instance, you can specify several parameters:
var ark = new InistArk({
naan: '67375',
subpublisher: '',
hyphen: true,
alphabet: '0123456789BCDFGHJKLMNPQRSTVWXZ'
});