UNPKG

lincd-design-elems

Version:

32 lines (25 loc) 1.25 kB
import {NamedNode} from 'lincd/lib/models'; import {JSONLD} from 'lincd-jsonld/lib/utils/JSONLD'; import {createNameSpace} from 'lincd/lib/utils/NameSpace'; import {linkedOntology} from '../package'; //finally, we pass on all the exports, plus the namespace, prefix and data loading function // as we register this ontology in the LINCD tree import * as _this from './example-ontology'; let dataFile = '../data/example-ontology.json'; export var loadData = () => { return import(dataFile).then((data) => JSONLD.parse(data)); }; export var ns = createNameSpace('${uri_base}'); //It's recommended to export a NamedNode for the ontology itself as well export var _self: NamedNode = ns(''); //The main goal though of this file is to export a reference to NamedNode with the correct URI // for all the entities (Classes and properties) in the ontology export var ExampleClass: NamedNode = ns('ExampleClass'); export var exampleName: NamedNode = ns('exampleName'); export const exampleOntology = { ExampleClass, exampleName, }; //as third parameter, provide a prefix (string) that can be used to refer to the full ontology URL. //for example: 'schema' refers to https://www.schema.org/ linkedOntology(_this, ns, 'exampl', loadData, dataFile);