Skip to content

OntoUML/ontouml-schema

Repository files navigation

OntoUML Schema

This repository provides a JSON Schema representation of ontologies based on the OntoUML Metamodel. This serialization of ontologies in JSON is intended to support the exchange of models over HTTP requests.

How to use

JSON Schema is a popular web standard for the definition and validation of JSON files. The standard employs JSON files to describe schemas of valid input data.

This standard is language-independent and the schema can be recovered directly through its dedicated URI <https://w3id.org/ontouml/schema/v1.0.0\> (unstable as of August 22). Some implementations of JSON Schema can directly resolve this URI and download the schema.

Javascript developers, however, can directly download this dependency using the command below.

> npm install ontouml-schema

The code snippet below shows how a developer can then use a dedicated library such as Ajv to validate objects against this schema.

const schema = require('ontouml-schema');
const Ajv = require('ajv');

const validator = new Ajv().compile(schema);
const project = {
  type: 'Project',
  id: 'p1',
  name: {
    en: 'My Ontology'
  }
};
const isValid = validator(project);

if (isValid) {
  console.log(`Project '${project.name.en}' is valid!`);
} else {
  console.log(`Project '${project.name.en}' is NOT valid!`);
  console.log(validator.errors);
}

Development

For development purposes only, this repository is designed as a NodeJS project. This project includes a small set of development dependencies, none of which is required on dependent projects. Users should only refer to the JSON file dist/ontouml-schema.json and available usage guides.

Developers interacting with this project must start by installing its dependencies. The start command then activates the automated code formatting for all relevant files when these are saved.

> npm ci

All changes to the OntoUML Schema must be performed in the YAML file src/ontouml-schema.yaml. The command below should then be executed to generate its JSON equivalent. To ensure that changes to the source file are not ignored, this command is automated on commit and on prepublish.

> npm run generate

The command below then tests the JSON version of the schema file, raising error messages in case of mistakes in the usage of JSON Schema.

> npm test

Testing scripts and updated usage guides shall be introduced to this repository in the next steps.

Contributors

This project is maintained by the Semantics, Cybersecurity & Services (SCS) Group of the University of Twente, The Netherlands.

The main contributors are:

About

JSON Schema definition of a OntoUML Model Exchange file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •