Introduction

The Aspect Model loader can be used to load an Aspect Model to traverse and access the different information a model provides (units, descriptions, constraints, etc.) to implement generic frontends capable to automatically adapt to the underling Aspect Model. For example a newly added property and the related value could be shown in the UI including all information (name, description and unit) without changing any line of code.

Getting Started

Install from GitHub release repository

npm install https://github.com/eclipse-esmf/esmf-sdk-js-aspect-model-loader/releases/download/v2.3.0/esmf-aspect-model-loader-2.3.0.tgz

Usage

This package contains two methods for loading Turtle (.ttl) files (string value of the .ttl files).

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 additional ttl files:

new AspectModelLoader().load('<aspect-model-urn>', ttl-1, ttl-2, ttl-3).subscribe((aspect: Aspect) => {
...
});

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.

Helpful functions

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)

Development

Create bundle

npm run build

to build and to create the library

Update indexes

ctix create ./src

to update all index files under src. For more information see the project https://github.com/imjuni/create-ts-index.