gbv / avram-js Goto Github PK
View Code? Open in Web Editor NEWAvram Schema Language implementation in JavaScript
Home Page: https://gbv.github.io/avram-js/
License: MIT License
Avram Schema Language implementation in JavaScript
Home Page: https://gbv.github.io/avram-js/
License: MIT License
Validator returns a list of validation errors but format of an error needs to be specified.
Formerly included as Analyzer
This library should be agnostic to MARC or PICA. Preprocessing MARC data to be fed into avram validator is out of the scope of this project
--format
--values
--subfields
--schema
Current dev also anticipates some of Avram 0.9.3. Requires https://github.com/gbv/avram/milestone/7 to be released.
Looks like this:
LDR 01000cam a2200265 4500
001 1844949419
245 10 _aKirschblütenküsse auf Mallorca
_cKeri Anne Arden
935 _iSLoT
951 _aBO
_bj
To include additional requirements of Avram format and possibly give warnings.
The web application in docs/
is broken because it required Analyzer
(see #4) but this is not the main purpose of avram-js anyway. Better add validation demo instead. See https://csvlint.io/ for a similar application.
Errors are defined at https://github.com/gbv/avram-js/blob/main/test/suite/README.md and partly documented in main README.md but implementation slightly differs. In addition to consistent definition, include
Primary use case MARC data. Could be hard-coded in lib/record
. In any case, record types are
--type
marc21bibliographicRecordType
Default could be to enable marc21bibliographicRecordType unless --type ""
is given.
The provider could be set with -x, --extension [name]
where name
is a node package or local file. The extension can provide methods detectRecordTypes(fields)
as well as rules ( #15), e.g. loadRule
returning an object with methods checkRecord
, checkField
, checkSubfield
.
Definition of rule ids has been changed to be IRI references.
Requires a method to load/supply code via plugins and/or a ruleLoader.
xsd:nonNegativeInteger
) to executable codeplugins
with name(s) of node modules or relative JavaScript files to be loadedA plugin (aka rule engine) gets the external rule (string or object) and returns a rule checker. A rule checker is a function that gets a record/field/subfield and returns a (possibly empty) array of errors. An error is a JSON object with keys message
. Additional keys error
(rule id), tag
, occurrence
, are set automatically by caller.
Rules at upper level Avram elements are initialized first, so in this case:
{
"fields": {
"abc": {
"rules": [ "x-rule" ]
}
},
"rules": [
{ "id": "x-rule", .. }
]
}
The rule engine knows about { "id": "x-rule", .. }
first so it can use "x-rule"
as reference to the former rule.
Included in t/files
and t/schemas
but not covered by tests yet.
There seems to be no JavaScript PICA parser so create of port of https://metacpan.org/release/PICA-Data
Use of this module can better be illustrated with actual example files. Especially MARC21 should be shown, based in schema files available via https://github.com/timathom/marc-schema.
Common user story: I have MARC21 files, how do I check them against MARC21 format specification?
A flat family Avram schema can be converted to a JSON Table Schema. See also https://csvlint.io/about.
marcjs ignores errors. Maybe https://www.npmjs.com/package/marcrecord works or a proper MARC parser needs to be implemented.
Missing:
Then check against the validation rules in the specification
This should work but does not:
./bin/avram-analyze test/files/sandburg.xml.gz
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.