/fmi2rdf

Extract triples about Functional Mock-up Units (FMUs) in Resource Description Framework (RDF)

Primary LanguagePython

The FMI-Ontology and fmi2rdf-Parser

Code style: black Imports: isort

Extracts facts about Functional Mock-up Units (FMUs) and represents them as triples using the Resource Description Framework (RDF). The goal is to enable the use of FMUs in the context of the Semantic Web.

This repository contains two essential building blocks for doing so: the FMI-ontology and the fmi2rdf-parser. The ontology is essentially a transcription of definitions in the FMI standard document (v2.0.2); rdfs:comment-annotations are mostly verbatim copies of the definitions in that document.

The parser creates a representation of a FMU in RDF. The information extracted includes metadata and structural information about the model as exposed in the modelDescription.xml-file as well as additional facts. It is primarily encoded using the FMI-ontology as well as the Systems Modelling and Simulation (SMS)-ontology, in conjunction with commonly used ontologies such as RDF, XSD, DCT and SOSA.

fmi2rdf relies on FMPy for handling FMUs and rdflib for creating an RDF graph.

Installation

Get a local copy of the code in this repository by cloning or downloading a release. Then, install the dependencies using poetry install and activate the resulting virtual environment with poetry shell.

For details, see the dependency specification in pyproject.toml the documentation of poetry.

Usage

fmi2rdf can be used via a Command-Line Interface (CLI) as well as from Python source code.

The CLI is implemented using Invoke. List the available functionality using invoke --list and display the documentation for specific functionality using, for example, invoke --help fmu2rdf.

The generated graph can be stored to a file when the --output-option is supplied. Through the --format-option, the formats for graph serialization supported by rdflib can be selected.

For using fmi2rdf in Python, import and use the assemble_graph(..)-function, which returns an instance of rdflib.graph.Graph.

Concepts

…​

Known Issues

To be resolved as soon as possible
  • ❏ Shape for simulation incomplete—​solver settings missing!

  • ❏ Type casting for enumerations not yet implemented

  • ❏ Explanation of concepts missing in README

To be resolved soonish
  • ❏ Create release (tag, GitHub)

  • ❏ Extend test coverage

  • ❏ Revise generated shapes—​concise, complete, useful?

  • ❏ Release as package on PyPI?

  • ❏ Work on TODO-markers in source code

  • ❏ …​

To be resolved eventually
  • ❏ Improve score in FOOPS! scanner

  • ❏ …​

Contributing and Development

Feedback on the FMI-ontology and the fmi2rdf-parser are very welcome! Please open an issue for questions, remarks and bug reports; or open a pull request if you want to improve something.

The code in this repository uses Semantic Versioning (semver) and follows the semver specification.

The Python code is formatted automatically using black and isort.

License

Parser and ontology are licensed under the MIT License. This is specified in the format suggested by the REUSE SOFTWARE-initiative. In short: SPDX IDs are included in every textual file and the license text can be found in ./LICENSES/.