You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Check New Pull Request](#check-new-pull-request)
21
-
*[Build release](#build-release)
22
-
<!-- TOC -->
23
-
24
4
# An Aspect of the Meta Model
25
5
26
6
The `esmf-aspect-model-loader` package provides the Python implementation for the SAMM Aspect Meta Model, or SAMM.
27
7
Each Meta Model element and each Characteristic class is represented by an interface with a corresponding
28
8
implementation.
29
9
10
+
## Documentation
11
+
12
+
* Check the [developer documentation](https://eclipse-esmf.github.io)
13
+
* Check the SAMM [specification](https://eclipse-esmf.github.io/samm-specification/snapshot/index.html)
14
+
* Having issues with the ESMF SDK Python Aspect Model Loader? Open a [GitHub issue](https://github.com/eclipse-esmf/esmf-sdk-py-aspect-model-loader/issues).
15
+
30
16
## Set Up SAMM Aspect Meta Model
31
17
32
18
Before getting started to use the `esmf-aspect-model-loader` library you need to apply some set up actions:
@@ -85,55 +71,42 @@ poetry run download-samm-branch
85
71
```
86
72
Link to all branches: [SAMM Releases](https://github.com/eclipse-esmf/esmf-semantic-aspect-meta-model/branches)
87
73
88
-
## Input data handler usage
89
-
90
-
The InputHandler is a general-purpose class designed for loading input data into an RDF graph.
91
-
It easily accommodates different input sources such as local files (.ttl) or direct data strings containing
92
-
RDF formatted data.
74
+
## SAMM Aspect Model Graph usage
93
75
76
+
SAMM Aspect Model Graph is a class that allows you to load and interact with the Semantic Data Aspect Meta Model graph.
77
+
Below is an example of how to use SAMM Aspect Model Graph in your Python code:
94
78
```python
95
-
from esmf_aspect_meta_model_python.resolver.handlerimportInputHandler
79
+
from esmf_aspect_meta_model_python importSAMMGraph
96
80
97
-
# Instantiating the Handler
98
-
# The InputHandler requires a path or data string upon instantiation, which defines the source of RDF data
99
-
# local file
100
-
model_path ="path/to/local/file/AspectName.ttl"
101
-
handler = InputHandler(model_path)
102
-
graph, aspect_urn = handler.get_rdf_graph()
81
+
# Define the path to your Turtle file
82
+
model_path ="absolute/path/to/turtle.ttl"
103
83
104
-
#returns a tuple containing the RDF graph and the aspect URN derived from the provided data source
105
-
```
84
+
#Create an instance of SAMMGraph
85
+
samm_graph = SAMMGraph()
106
86
107
-
```python
108
-
from esmf_aspect_meta_model_python.resolver.handler import InputHandler
87
+
# Parse the Turtle file to load the graph
88
+
samm_graph.parse(model_path)
109
89
110
-
# Alternatively, if you have RDF data in a string format, you can directly pass it as follows:
111
-
rdf_data_string ="your RDF data string here"
112
-
handler = InputHandler(rdf_data_string)
113
-
graph, aspect_urn = handler.get_rdf_graph()
90
+
# Load the aspect model from the graph
91
+
aspect = samm_graph.load_aspect_model()
114
92
```
115
93
116
-
## Aspect Meta Model Loader usage
117
-
118
-
An Aspect of the Meta Model can be loaded as follows:
94
+
The `load_model_elements` method in the SAMMGraph class creates Python objects to represent all nodes from the Aspect
95
+
model graph. It retrieves all SAMM elements from the RDF graph and converts them into structured Python objects.
119
96
```python
120
-
from esmf_aspect_meta_model_python import AspectLoader
121
-
from esmf_aspect_meta_model_python.resolver.handler import InputHandler
97
+
from esmf_aspect_meta_model_python import SAMMGraph
Copy file name to clipboardExpand all lines: core/esmf-aspect-meta-model-python/esmf_aspect_meta_model_python/impl/characteristics/collection/default_collection.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ class DefaultCollection(DefaultCharacteristic, Collection):
Copy file name to clipboardExpand all lines: core/esmf-aspect-meta-model-python/esmf_aspect_meta_model_python/impl/characteristics/default_characteristic.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@
8
8
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copy file name to clipboardExpand all lines: core/esmf-aspect-meta-model-python/esmf_aspect_meta_model_python/impl/data_types/default_abstract_entity.py
0 commit comments