Skip to content

Commit

Permalink
Move Avram Schemas to directory 'avram-schemas'
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtich committed May 29, 2024
1 parent 7910967 commit 67cbc6f
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 39 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/avram.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g [email protected] 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

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ setdir.sh

# used as Docker volume
web-config

# Node packages
node_modules
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions avram-schemas/README.md
Original file line number Diff line number Diff line change
@@ -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
```
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
File renamed without changes.
15 changes: 15 additions & 0 deletions avram-schemas/validate-schemas
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions common-script
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 0 additions & 6 deletions marc-schema/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion qa-catalogue
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/main/assembly/release.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
<outputDirectory>scripts</outputDirectory>
</fileSet>
<fileSet>
<directory>marc-schema</directory>
<directory>avram-schemas</directory>
<includes>
<include>*.*</include>
</includes>
<outputDirectory>marc-schema</outputDirectory>
<outputDirectory>avram-schemas</outputDirectory>
</fileSet>
<fileSet>
<directory>catalogues</directory>
Expand Down Expand Up @@ -164,4 +164,4 @@
<source>setdir.sh.template</source>
</file>
</files>
</assembly>
</assembly>
2 changes: 1 addition & 1 deletion src/main/resources/marc-schema.json

0 comments on commit 67cbc6f

Please sign in to comment.