This project enables developers to effortlessly load and parse one or more .ttl files and instantiate native TypeScript objects of the pared SAMM semantic concepts.
Are you having trouble with ESMF JS? We want to help!
- Check the developer documentation
- Having issues with the ESMF JS? Open a GitHub issue.
npm install @esmf/aspect-model-loader
Instantiating an Aspect the following two methods for loading ttl files(string value of the .ttl files) are provided.
Load an aspect model which is self-contained (includes no imports to other ttl file):
new AspectModelLoader().loadSelfContainedModel(ttl).subscribe((aspect: Aspect) => {
...
});
or if the model contains imports to further ttl files:
new AspectModelLoader().load('<aspect-model-urn>', ttl-1, ttl-2, ttl-3, ...).subscribe((aspect: Aspect) => {
...
});
Besides loading an aspect the project also supports to load and group the SAMM definitions by namespace.
Load all namespace and related SAMM semantic concepts:
new NamespaceLoader().load(ttl-1, ttl-2, ttl-3, ...).subscribe((namespaces: Observable<Map<string, Array<BaseMetaModelElement>>>) => {
...
});
If you are using external .ttl files you may need to parse the contents of these files to strings, to be passed to the methods params. Further all .ttl files must use the same SAMM version. Loading SAMM semantic concepts from different .ttl files having different SAMM versions is not supported yet.
This module exposes some helper functions that can be used to find items inside the loaded ttl object.
Find a specific model element, and returns it or undefined.
let specificElement = loader.findByUrn(options.urnSelectedModelElement)
Find a specific model element by name, and returns the found elements.
let specificElement = loader.findByName(options.selectedModelName)
npm run build
to build and to create the library
ctix create ./src
to update all index files under src
. For more information see the project https://github.com/imjuni/create-ts-index.
Further documentation and HowTos are provided in the official JS SDK User Documentation
SPDX-License-Identifier: MPL-2.0
This program and the accompanying materials are made available under the terms of the Mozilla Public License, v. 2.0.
The Notice file details contained third party materials.