From 67cbc6f6e3b55eaeedf9ca63985ea0c57d07af48 Mon Sep 17 00:00:00 2001 From: Jakob Voss Date: Wed, 29 May 2024 19:54:18 +0200 Subject: [PATCH] Move Avram Schemas to directory 'avram-schemas' --- .github/workflows/avram.yml | 14 +++----------- .gitignore | 3 +++ README.md | 19 +++++++++++-------- avram-schemas/README.md | 11 +++++++++++ .../marc-schema-with-solr-and-extensions.json | 4 ++-- .../marc-schema-with-solr.json | 4 ++-- .../marc-schema.json | 0 avram-schemas/validate-schemas | 15 +++++++++++++++ common-script | 10 +++++----- marc-schema/README.md | 6 ------ qa-catalogue | 2 +- src/main/assembly/release.xml | 6 +++--- src/main/resources/marc-schema.json | 2 +- 13 files changed, 57 insertions(+), 39 deletions(-) create mode 100644 avram-schemas/README.md rename {marc-schema => avram-schemas}/marc-schema-with-solr-and-extensions.json (99%) rename {marc-schema => avram-schemas}/marc-schema-with-solr.json (99%) rename {marc-schema => avram-schemas}/marc-schema.json (100%) create mode 100755 avram-schemas/validate-schemas delete mode 100644 marc-schema/README.md diff --git a/.github/workflows/avram.yml b/.github/workflows/avram.yml index 44434b819..d5c3aba32 100644 --- a/.github/workflows/avram.yml +++ b/.github/workflows/avram.yml @@ -12,15 +12,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - run: npm install -g avram@0.6.6 ajv ajv-formats # checking Avram 0.9.6 + - run: npm install - name: Validate Avram Schema files - run: | - avram -s marc-schema/marc-schema.json - avram -s src/main/resources/marc-schema.json - avram -s src/main/resources/marc/authority-schema.avram.json - avram -s src/main/resources/pica-schema.json - avram -s src/main/resources/pica/avram-k10plus-title.json - avram -s src/main/resources/unimarc/avram-unimarc.json - avram -s src/test/resources/pica/schema/pica-schema-extra.json - avram -s src/test/resources/pica/schema/pica-schema.json - avram -s src/test/resources/unimarc/avram-unimarc.json + run: ./avram-schemas/validate-schemas + diff --git a/.gitignore b/.gitignore index 6c2082011..38337b166 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,6 @@ setdir.sh # used as Docker volume web-config + +# Node packages +node_modules diff --git a/README.md b/README.md index 3db205bb9..bcd7e8111 100644 --- a/README.md +++ b/README.md @@ -2034,14 +2034,13 @@ The MARC JSON file is a JSON serialization of binary MARC file. See more the Some background info: [MARC21 structure in JSON](http://pkiraly.github.io/2018/01/28/marc21-in-json/). Usage: + ```bash -java -cp $JAR de.gwdg.metadataqa.marc.cli.utils.MappingToJson [options] > marc-schema -``` -with script: -```bash -catalogues/[catalogue].sh export-schema-files +java -cp $JAR de.gwdg.metadataqa.marc.cli.utils.MappingToJson [options] > avram-schema.json ``` + or + ```bash ./qa-catalogue --params="[options]" export-schema-files ``` @@ -2122,9 +2121,13 @@ An example output: ``` The script version generates 3 files, with different details: -* `marc-schema/marc-schema.json` -* `marc-schema/marc-schema-with-solr.json` -* `marc-schema/marc-schema-with-solr-and-extensions.json` +* `avram-schemas/marc-schema.json` +* `avram-schemas/marc-schema-with-solr.json` +* `avram-schemas/marc-schema-with-solr-and-extensions.json` + +To validate these files install the Avram reference implementation in Node with `npm install` and run: + + ./avram-schemas/validate-schemas ### to HTML diff --git a/avram-schemas/README.md b/avram-schemas/README.md new file mode 100644 index 000000000..75b512347 --- /dev/null +++ b/avram-schemas/README.md @@ -0,0 +1,11 @@ +To generate these files, run + +```bash +./qa-catalogue export-schema-files +``` + +To validate the files, run + +```bash +./avram-schemas/validate-schemas +``` diff --git a/marc-schema/marc-schema-with-solr-and-extensions.json b/avram-schemas/marc-schema-with-solr-and-extensions.json similarity index 99% rename from marc-schema/marc-schema-with-solr-and-extensions.json rename to avram-schemas/marc-schema-with-solr-and-extensions.json index 8b7769012..2f90da3b1 100644 --- a/marc-schema/marc-schema-with-solr-and-extensions.json +++ b/avram-schemas/marc-schema-with-solr-and-extensions.json @@ -13661,7 +13661,7 @@ "b": { "label": "Source of stock number/acquisition", "repeatable": false, - "solr": "037b_AcquisitionSourcelabel" + "solr": "037b_AcquisitionSource_label" }, "c": { "label": "Terms of availability", @@ -14854,7 +14854,7 @@ "d": { "label": "Populated place name", "repeatable": true, - "solr": "052d_GeographicClassificationlabel" + "solr": "052d_GeographicClassification_label" }, "0": { "label": "Authority record control number or standard number", diff --git a/marc-schema/marc-schema-with-solr.json b/avram-schemas/marc-schema-with-solr.json similarity index 99% rename from marc-schema/marc-schema-with-solr.json rename to avram-schemas/marc-schema-with-solr.json index 39a753cd9..6141e63bf 100644 --- a/marc-schema/marc-schema-with-solr.json +++ b/avram-schemas/marc-schema-with-solr.json @@ -13056,7 +13056,7 @@ "b": { "label": "Source of stock number/acquisition", "repeatable": false, - "solr": "037b_AcquisitionSourcelabel" + "solr": "037b_AcquisitionSource_label" }, "c": { "label": "Terms of availability", @@ -13902,7 +13902,7 @@ "d": { "label": "Populated place name", "repeatable": true, - "solr": "052d_GeographicClassificationlabel" + "solr": "052d_GeographicClassification_label" }, "0": { "label": "Authority record control number or standard number", diff --git a/marc-schema/marc-schema.json b/avram-schemas/marc-schema.json similarity index 100% rename from marc-schema/marc-schema.json rename to avram-schemas/marc-schema.json diff --git a/avram-schemas/validate-schemas b/avram-schemas/validate-schemas new file mode 100755 index 000000000..eaab1787d --- /dev/null +++ b/avram-schemas/validate-schemas @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +validate() { + npm run --silent avram -- -s $@ +} + +validate avram-schemas/marc-schema.json +validate src/main/resources/marc-schema.json +validate src/main/resources/marc/authority-schema.avram.json +validate src/main/resources/pica-schema.json +validate src/main/resources/pica/avram-k10plus-title.json +validate src/main/resources/unimarc/avram-unimarc.json +validate src/test/resources/pica/schema/pica-schema-extra.json +validate src/test/resources/pica/schema/pica-schema.json +validate src/test/resources/unimarc/avram-unimarc.json diff --git a/common-script b/common-script index 2fd8a9abb..5ff6de2df 100755 --- a/common-script +++ b/common-script @@ -423,15 +423,15 @@ EOF } do_export_schema_files() { - mkdir -p marc-schema + mkdir -p avram-schemas run avram untrace - ./export-schema --withSubfieldCodelists | jq . > marc-schema/marc-schema.json - ./export-schema --withSubfieldCodelists --solrFieldType mixed --withSelfDescriptiveCode | jq . > marc-schema/marc-schema-with-solr.json - ./export-schema --withSubfieldCodelists --solrFieldType mixed --withSelfDescriptiveCode --withLocallyDefinedFields | jq . > marc-schema/marc-schema-with-solr-and-extensions.json + ./export-schema --withSubfieldCodelists | jq . > avram-schemas/marc-schema.json + ./export-schema --withSubfieldCodelists --solrFieldType mixed --withSelfDescriptiveCode | jq . > avram-schemas/marc-schema-with-solr.json + ./export-schema --withSubfieldCodelists --solrFieldType mixed --withSelfDescriptiveCode --withLocallyDefinedFields | jq . > avram-schemas/marc-schema-with-solr-and-extensions.json - log "files generated at 'marc-schema' directory: marc-schema.json, marc-schema-with-solr.json, marc-schema-with-solr-and-extensions.json" + log "files generated at 'avram-schemas' directory: marc-schema.json, marc-schema-with-solr.json, marc-schema-with-solr-and-extensions.json" } do_shacl4bib() { diff --git a/marc-schema/README.md b/marc-schema/README.md deleted file mode 100644 index 6d3b53566..000000000 --- a/marc-schema/README.md +++ /dev/null @@ -1,6 +0,0 @@ -To generate these files, run - -```bash -./common-script export-schema-files -``` - diff --git a/qa-catalogue b/qa-catalogue index 57367ec31..5e50c6c16 100755 --- a/qa-catalogue +++ b/qa-catalogue @@ -91,7 +91,7 @@ TYPE_PARAMS (params): ${TYPE_PARAMS} UPDATE: ${UPDATE:-} VERSION: ${VERSION:-} WEB_CONFIG: ${WEB_CONFIG} -ENV_FILE: ${ENV_FILE} +ENV_FILE: ${ENV_FILE:-} --------------------------- EOF diff --git a/src/main/assembly/release.xml b/src/main/assembly/release.xml index 4a843d5a0..61a198dba 100644 --- a/src/main/assembly/release.xml +++ b/src/main/assembly/release.xml @@ -53,11 +53,11 @@ scripts - marc-schema + avram-schemas *.* - marc-schema + avram-schemas catalogues @@ -164,4 +164,4 @@ setdir.sh.template - \ No newline at end of file + diff --git a/src/main/resources/marc-schema.json b/src/main/resources/marc-schema.json index 009389b7b..45b746507 120000 --- a/src/main/resources/marc-schema.json +++ b/src/main/resources/marc-schema.json @@ -1 +1 @@ -../../../marc-schema/marc-schema.json \ No newline at end of file +../../../avram-schemas/marc-schema.json \ No newline at end of file