Skip to content

techlib/NKR-vocabs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NKR-vocabs

Repository for managing RDF/SKOS vocabularies used in the NKR/CCMM ecosystem.

This repository provides:

  • RDF/SKOS vocabulary storage
  • Multi-format serialization support
  • Validation workflows
  • SKOS normalization/fixing workflows
  • GitHub Actions automation

Supported formats:

  • Turtle (.ttl)
  • RDF/XML (.rdf)
  • JSON-LD (.jsonld)
  • N-Triples (.nt)
  • Source XML (.xml) for conversion sources only

Repository Structure

.
├── .github/
│   └── workflows/
│       ├── validate-skos.yml
│       ├── fix-skos.yml
│       └── convert-vocabularies.yml
│
├── scripts/
│   ├── validate_skos.sh
│   ├── fix_skos.sh
│   └── convert_vocabularies.py
│
├── vocabularies/
│   ├── access_rights/
│   ├── resource_types/
│   ├── languages-skos/
│   ├── filetypes-skos/
│   └── ...
│
└── README.md

Vocabulary Serialization Strategy

Each vocabulary folder should contain equivalent serializations of the same vocabulary.

Example:

resource_types/
├── resource_types.rdf
├── resource_types.ttl
├── resource_types.jsonld

Source Priority Rules

The conversion script uses priority-based source selection.

Priority order:

  1. .rdf
  2. .ttl
  3. .jsonld
  4. .nt
  5. .xml

Meaning:

  • If .rdf exists, it becomes the canonical source
  • Otherwise .ttl
  • Otherwise .jsonld
  • Otherwise .nt
  • Otherwise .xml

Generated formats:

Source Generated
.rdf .ttl, .jsonld
.ttl .rdf, .jsonld
.jsonld .rdf, .ttl
.nt .rdf, .ttl, .jsonld
.xml .rdf, .ttl, .jsonld

Validation Script

Script:

scripts/validate_skos.sh

Purpose:

  • RDF syntax validation using Apache Jena riot
  • SKOS validation using skosify

Supported validation formats:

  • .ttl
  • .rdf
  • .jsonld
  • .json-ld
  • .nt

Regular XML source files are NOT validated.

Example usage

Validate all vocabularies:

./scripts/validate_skos.sh vocabularies

Validate one vocabulary:

./scripts/validate_skos.sh vocabularies/resource_types

SKOS Fix Script

Script:

scripts/fix_skos.sh

Purpose:

  • Normalize SKOS vocabularies
  • Remove redundant hierarchy relations
  • Clean labels
  • Apply skosify cleanup rules

Example usage

./scripts/fix_skos.sh vocabularies

After fixing:

./scripts/validate_skos.sh vocabularies

Vocabulary Conversion Script

Script:

scripts/convert_vocabularies.py

Purpose:

  • Convert vocabularies between RDF serializations
  • Auto-select canonical source format by priority
  • Generate missing formats

Run Conversion

Convert all vocabularies:

python scripts/convert_vocabularies.py vocabularies --overwrite

Convert one vocabulary:

python scripts/convert_vocabularies.py vocabularies/resource_types --overwrite

GitHub Actions

Validate SKOS

Workflow:

.github/workflows/validate-skos.yml

Run:

GitHub → Actions → Validate SKOS → Run workflow

Fix SKOS

Workflow:

.github/workflows/fix-skos.yml

Run:

GitHub → Actions → Fix SKOS → Run workflow

Convert Vocabularies

Workflow:

.github/workflows/convert-vocabularies.yml

Run:

GitHub → Actions → Convert Vocabularies → Run workflow

Notes About XML

There are two XML cases.

RDF/XML

Supported RDF serialization:

file.rdf

Handled by:

  • validation
  • fixing
  • conversion

Regular XML Source Files

Example:

iana-media-types.xml

These are NOT RDF/XML.

They are source data and require dedicated XML → SKOS conversion logic.

They are intentionally excluded from validation/fixing workflows.

About

Controlled vocabularies consumed by the NKR Skosmos tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors