Skip to content

Convert OWL/RDFS and XML Schema to a canonical JSON Schema (draft 4) representation.

License

Notifications You must be signed in to change notification settings

redaktor/owl2jsonschema.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

owl2jsonschema.js

WIP

Do not use for production yet. Might change or rename at anytime. Please do report bugs!

Convert OWL / RDFS / XML Schema to JSON Schema.

OWL 2 JSON SCHEMA wants to build a bridge between the semantically XML web and the semantically JSON web and is a converter from OWL as RDF/XML to JSON Schema (currently draft 4). Full XML Schema support will come soon. For now an OWL Ontology is required.

Why?
Most ontologies on the web use OWL+RDF/XML or RDF/Turtle or RDF/NTriples (which translate 1:1 to RDF/XML).
spec.:

"The primary exchange syntax for OWL 2 is RDF/XML; this is indeed the only syntax that must be supported by all OWL 2 tools."

So RDF/XML Schema is Lingua Franca. Let us create a canonical JSON representation for this.

It is planned to support several proposals for JSON Schema v5 draft which close gaps between OWL and JSON Schema. For example

So whenever the documentation refers to "JSON Schema" it means :
"JSON Schema and hyperschema - including the above mentioned inofficial proposals".

This is nightly written from scratch, might currently contain bugs and is incomplete.
Currently working on: The resolving of external URIs and Ontologies.

Supported platforms

node.js >= 0.10.0

Installation

For now

git clone https://github.com/redaktor/owl2jsonschema.js.git
cd owl2jsonschema.js
npm install

A demo is included. It will create the JSON Schemas of the dbpedia Ontology.
This will create the schema files in demo/OUTPUT:

node demo

Usage

var owl2jsonschema = require('owl2jsonschema');
var parser = new owl2jsonschema(/*[options object]*/);

and now parse url OR file OR string

// url, options, callback

parser.parse('http://mappings.dbpedia.org/server/ontology/export' /*, [callback function]*/ );

OR
// filepath, options, callback
(if filepath is relative then './' is the folder of your script)

parser.parse('./export.xml' /*, [callback function]*/);

OR
// string, options, callback

parser.parse('<?xml><rdf:RDF><owl:Ontology>...</owl:Ontology>...</rdf:RDF>' /*, [callback function]*/);

This will write JSON schema files - you can specify options - see the code for now. Several Database support is planned within the redaktor boilerplate.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

TODO: Write history

Credits

Once OWL/RDFS is transformed, this uses the logic of schema-org-gen by Geraint Luff.

License

TODO: Write license

About

Convert OWL/RDFS and XML Schema to a canonical JSON Schema (draft 4) representation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published