Skip to content

Commit 3f7e08a

Browse files
committed
Add doc for antora
1 parent be49070 commit 3f7e08a

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ ctix create ./src
9898

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

101+
## Documentation
102+
103+
Further documentation and howto's are provided in the
104+
official [JS SDK Aspect Model loader User Documentation](https://openmanufacturingplatform.github.io/sds-documentation/js-sdk-aml-guide/index.html)
105+
101106
## License
102107

103108
SPDX-License-Identifier: MPL-2.0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: js-sdk-aml-guide
2+
title: JavaScript SDK Aspect Model loader
3+
version: master
4+
start_page: ROOT:index.adoc
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
////
2+
Copyright (c) 2022 Robert Bosch Manufacturing Solutions GmbH
3+
4+
See the AUTHORS file(s) distributed with this work for additional
5+
information regarding authorship.
6+
7+
This Source Code Form is subject to the terms of the Mozilla Public
8+
License, v. 2.0. If a copy of the MPL was not distributed with this
9+
file, You can obtain one at https://mozilla.org/MPL/2.0/.
10+
11+
SPDX-License-Identifier: MPL-2.0
12+
////
13+
14+
= Introduction
15+
16+
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.
17+
For example a new 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.
18+
19+
== Getting Started
20+
21+
=== Install from the public npm (Currently not available):
22+
23+
[source,bash]
24+
----
25+
npm install @sds/aspect-model-loader
26+
----
27+
28+
=== Install from github release repository:
29+
30+
[source,bash]
31+
----
32+
npm install https://github.com/OpenManufacturingPlatform/sds-sdk-js-aspect-model-loader/releases/download/<TAG_VERSION>/sds-aspect-model-loader-x.x.x.tgz
33+
----
34+
35+
== Usage
36+
37+
This package contains two methods for loading ttl files(string value of the .ttl files).
38+
39+
Load an aspect model which is self-contained (includes no imports to other ttl file):
40+
41+
[source,bash]
42+
----
43+
new AspectModelLoader().loadSelfContainedModel(ttl).subscribe((aspect: Aspect) => {
44+
...
45+
});
46+
----
47+
48+
or if the model contains imports to additional ttl files:
49+
50+
[source,bash]
51+
----
52+
new AspectModelLoader().load('<aspect-model-urn>', ttl-1, ttl-2, ttl-3).subscribe((aspect: Aspect) => {
53+
...
54+
});
55+
----
56+
57+
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.
58+
59+
== Helpful functions
60+
61+
This module exposes some helper functions that can be used to find items inside the loaded ttl object.
62+
63+
Find a specific model element, and returns it or undefined.
64+
65+
[source,bash]
66+
----
67+
let specificElement = loader.findByUrn(options.urnSelectedModelElement)
68+
----
69+
70+
Find a specific model element by name, and returns the found elements.
71+
72+
[source,bash]
73+
----
74+
let specificElement = loader.findByName(options.selectedModelName)
75+
----
76+
77+
== Development
78+
79+
=== Create bundle
80+
81+
[source,bash]
82+
----
83+
npm run build
84+
----
85+
86+
to build and to create the library
87+
88+
==== Update indexes
89+
90+
[source,bash]
91+
----
92+
ctix create ./src
93+
----
94+
95+
to update all index files under `src`.
96+
For more information see the project https://github.com/imjuni/create-ts-index.

0 commit comments

Comments
 (0)