0.3.0 • Published 4 years ago
nmspc v0.3.0
Namespace
A collection of RDF namespaces as javascript classes.
Usage
Install with npm install nmspc. Each namespace has a base URI and a prefix label for the sake of writing prefixed names (see the Turtle spec IRIs and the Wikipedia article on compact URIs). Other properties return the full URI of each resource defined in the namespace.
import * as NS from 'nmspc';
console.log("DC:", NS.DC.baseURI, NS.DC.creator);
// outputs: DC: http://purl.org/dc/terms/ http://purl.org/dc/terms/creator
console.log("RDF:", NS.RDF.baseURI, NS.RDF.Alt);
// outputs: RDF: http://www.w3.org/1999/02/22-rdf-syntax-ns# http://www.w3.org/1999/02/22-rdf-syntax-ns#AltNote
There is a generator written in typescript in the project. To generate namespace classes:
- Clone this project
git clone git@github.com:matthieubosquet/namespace.git - Install dev dependencies running
npm install - Edit
src/generator/runner.tsadding in your own ontology as NodeJS Readable stream - Run
npm run build-namespaceto generate a namespace class corresponding to your ontology
The prefixes used/recognised/required by the generator are:
vann:preferredNamespacePrefixfor the prefixLabel propertyvann:preferredNamespaceUrifor the baseUri propertyrdfs:isDefinedByfor every name defined in the namespacedc:issuedfor the version property
See the matthieubosquet/ontologies repository for example ontologies serialised as turtle and described using those aforementioned prefixes and OWL 2 annotation properties where possible.