Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matthieubosquet/namespace
https://github.com/matthieubosquet/namespace
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/matthieubosquet/namespace
- Owner: matthieubosquet
- Created: 2020-10-04T09:09:32.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-28T23:35:57.000Z (over 3 years ago)
- Last Synced: 2024-10-31T23:02:17.073Z (2 months ago)
- Language: TypeScript
- Size: 151 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://www.w3.org/TR/turtle/#sec-iri) and the [Wikipedia article on compact URIs](https://en.wikipedia.org/wiki/CURIE)). Other properties return the full URI of each resource defined in the namespace.
```javascript
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#Alt
```## Note
There is a generator written in typescript in the project. To generate namespace classes:
- Clone this project `git clone [email protected]:matthieubosquet/namespace.git`
- Install dev dependencies running `npm install`
- Edit `src/generator/runner.ts` adding in your own ontology as NodeJS Readable stream
- Run `npm run build-namespace` to generate a namespace class corresponding to your ontologyThe prefixes used/recognised/required by the generator are:
- `vann:preferredNamespacePrefix` for the prefixLabel property
- `vann:preferredNamespaceUri` for the baseUri property
- `rdfs:isDefinedBy` for every name defined in the namespace
- `dc:issued` for the version propertySee the [matthieubosquet/ontologies](https://github.com/matthieubosquet/ontologies) repository for example ontologies serialised as turtle and described using those aforementioned prefixes and [OWL 2 annotation properties](https://www.w3.org/TR/owl-syntax/#Annotation_Properties) where possible.