Skip to main content

The Aspect Model Loader as part of the Python SDK provided by the Eclipse Semantic Modeling Framework.

An Aspect of the Meta Model

The esmf-aspect-model-loader package provides the Python implementation for the SAMM Aspect Meta Model, or SAMM. Each Meta Model element and each Characteristic class is represented by an interface with a corresponding implementation.

Documentation

Set Up SAMM Aspect Meta Model

Before getting started to use the esmf-aspect-model-loader library you need to apply some set up actions:

Required

Install uv

uv is used as the dependency manager for the esmf-aspect-model-loader. Follow the next instruction to install it.

To check the uv version run:

uv --version

Install project dependencies

uv provides convenient functionality for working with dependencies in the project. To automatically create a virtual environment and install all the necessary libraries, just run one command:

uv sync

It is required to run uv sync once in the esmf-aspect-model-loader module.

Download SAMM files

There are two possibilities to download the SAMM files and extract the Turtle sources for the Meta Model: SAMM release or SAMM branch

Download SAMM release

This script downloads a release JAR-file from GitHub, extracts them for further usage in the Aspect Model Loader:

To run script, execute the next command.

uv run download-samm-release

The version of the SAMM release is specified in the python script.

Link to all Releases: SAMM Releases

Download SAMM branch

The script uses the GitHub API and downloads the files from the main GitHub branch.

If the script is run in a pipeline, it uses a GitHub token to authorize. If the script is run locally, the API is called without a token. This may cause problems because unauthorized API calls are limited.

Run the next command to download and start working with the Aspect Model Loader.

uv run download-samm-branch

Link to all branches: SAMM Releases

SAMM Aspect Model Graph usage

SAMM Aspect Model Graph is a class that allows you to load and interact with the Semantic Data Aspect Meta Model graph. Below is an example of how to use SAMM Aspect Model Graph in your Python code:

from esmf_aspect_meta_model_python import SAMMGraph

# Define the path to your Turtle file
model_path = "absolute/path/to/turtle.ttl"

# Create an instance of SAMMGraph
samm_graph = SAMMGraph()

# Parse the Turtle file to load the graph
samm_graph.parse(model_path)

# Load the aspect model from the graph
aspect = samm_graph.load_aspect_model()

The load_model_elements method in the SAMMGraph class creates Python objects to represent all nodes from the Aspect model graph. It retrieves all SAMM elements from the RDF graph and converts them into structured Python objects.

from esmf_aspect_meta_model_python import SAMMGraph

# Define the path to your Turtle file
model_path = "absolute/path/to/turtle.ttl"

# Create an instance of SAMMGraph
samm_graph = SAMMGraph()

# Parse the Turtle file to load the graph
samm_graph.parse(model_path)

# Load all model elements from the graph
model_elements = samm_graph.load_model_elements()

Samm Units

SAMMUnitsGraph is a class contains functions for accessing units of measurement.

from esmf_aspect_meta_model_python.samm_meta_model import SammUnitsGraph

units = SammUnitsGraph()

unit_name = "unit:volt"
units.print_info(units.get_info(unit_name))
# preferredName: volt
# commonCode: VLT
# ...
# symbol: V

# Get unit data as dictionary
volt_info = units.get_info("unit:volt")
# {'preferredName': rdflib.term.Literal('volt', lang='en'), 'commonCode': rdflib.term.Literal('VLT'), ... }

units.print_info(volt_info)
# preferredName: volt
# commonCode: VLT
# ...
# symbol: V

SAMM CLI wrapper class

The SAMM CLI is a command line tool provided number of functions for working with Aspect Models.

More detailed information about SAMM CLI functionality can be found in the SAMM CLI documentation.

Python Aspect Model Loader provide a wrapper class to be able to call SAMM CLI functions from the Python code. For instance, validation of a model can be done with the following code snippet:

from esmf_aspect_meta_model_python.samm_cli import SammCli

samm_cli = SammCli()
model_path = "Path_to_the_model/Model.ttl"
samm_cli.validate(model_path)
# Input model is valid

List of SAMMCLI functions:

  • validate
  • prettyprint
  • usage
  • to_openapi
  • to_schema
  • to_json
  • to_html
  • to_png
  • to_svg
  • to_java
  • to_asyncapi
  • to_jsonld
  • to_sql
  • to_aas
  • edit_move
  • edit_newversion
  • aas_to_aspect
  • aas_list
  • package_import
  • package_export

Scripts

The Aspect Model Loader provide scripts for downloading some additional code and data. Provided scripts:

  • download-samm-release
  • download-samm-branch
  • download-samm-cli
  • download-test-models

All scripts run like a uv command. uv is available from the folder where pyproject.toml is located.

Tests running

tox

tox is used for the tests automation purpose. There are two environments with different purposes and tests can be running with the tox:

  • pep8: static code checks (PEP8 style) with MyPy and Black
  • py311, py312, py313 and py314: unit and integration tests

tox-uv plugin

tox is integrated with uv through the tox-uv plugin. Both tox and tox-uv are declared as dev dependencies in pyproject.toml, so a single uv sync installs everything required - no separate installation step is needed.

The two environments use the plugin differently (see tox.ini):

  • pep8 uses the uv-venv-lock-runner provided by tox-uv, which provisions the environment directly from the pinned uv.lock and installs the dev dependency group. This guarantees the linters run with the exact, locked versions.
  • py311 uses the default runner and explicitly runs uv sync and uv run download-samm-release in its commands_pre to prepare dependencies and the SAMM meta model files before executing the test suite.
# run all checks use the next command
uv run tox

# run all checks in parallel use the next command
uv run tox run-parallel

# run only pep8 checks
uv run tox -e pep8

# run tests
uv run tox -e py311

Metadata

Release files for esmf-aspect-model-loader 2.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for esmf-aspect-model-loader 2.3.2
File Size Uploaded Provenance Actions
esmf_aspect_model_loader-2.3.2.tar.gz 563.8 kB Without provenance Details for esmf_aspect_model_loader-2.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for esmf-aspect-model-loader 2.3.2
File Interpreter ABI Platform Actions
esmf_aspect_model_loader-2.3.2-py3-none-any.whl Python 3 none any Details for esmf_aspect_model_loader-2.3.2-py3-none-any.whl

Total release size: 1.2 MB

Release files / esmf_aspect_model_loader-2.3.2.tar.gz

Download URL esmf_aspect_model_loader-2.3.2.tar.gz
Size 563.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ec8e79ee06b2c085a7312ac09bff19d132e6c79d640e2ac5dd5a820956510e1d
BLAKE2b-256 checksum
How to use checksums
72b3f71c6c4d80664258ff2f77c3ed06204684892e3415f4e7da0271595f20c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / esmf_aspect_model_loader-2.3.2-py3-none-any.whl

Download URL esmf_aspect_model_loader-2.3.2-py3-none-any.whl
Size 587.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7eb5947edf56837882eead81bde5b8f64b3bb0b540bb7f635014e7d4922f881
BLAKE2b-256 checksum
How to use checksums
fe0a2f9bb18772a4fffa95c010d336672467dffec8da15954b1a2ecd1f6e54e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for esmf-aspect-model-loader 2.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page