Skip to content

EMMC-ASBL/dlite-cuds

Repository files navigation

DLite2CUDS

Restrictions on the input CUDS when converting to DLite DataModel

The implementations has some severe restrictions for now:

  • An individual can only be an rdf:type of one class (i.e. it cannot be for instance both an rdf:type :Human and rdf:type Mother). In theory, it should not be a limitation but the current implementation does not allow it.

  • All individuals of the same type must have the exact same properties defined. Incomplete individuals are not accepted (i.e. individuals missing a property).

Restrictions on Dlite Models etc:

  • Three things are needed: Entity of interest (e.g. the DataModel), collection with data, collection with mappings.

  • Not only properties must be mapped, but also the concepts/entities themselves.

  • Every data provided need to be linked to a concept to be added to the graph.

  • Only single value data are supported (dimensionality in Dlite DataModel not yet implemented). The type of the values is also limited to standard types (str, int, ...)

An OTEAPI Plugin with OTE strategies.

Installation

It is recommended to work in a dedicated python environment.

dlite-cuds is currently not deployed on pypi, but can be installed directly from github with pip install git+https://github.com/EMMC-ASBL/dlite-cuds.git Note that it can only be used with oteapi-core < 0.6 (with pydantic v1), and is not updated to python3.11. This means that dlite-cuds is currently only possible to run with python < 3.11.

Further reading:

Test the plugin

There are two ways of testing this plugin: unit testing or end-to-end testing.

Unit tests

To run the unit tests, checking that all the Python code functionality works as intended, one needs to first install the development requirements:

cd /path/to/dlite-cuds
pip install -U -e .[dev]

Then one can run the tests through the pytest framework:

pytest

End-to-end testing

Here, end-to-end means using OTElib to initialize an OTEClient pointing at a running REST API service, similar to the one created by OTEAPI Services, and setting up a pipeline that utilizes the strategies from this plugin.

In order to test this locally, one requires Docker Compose. Then, one can setup a local REST API service that includes this plugin and test it with the following commands:

docker-compose -f docker-compose.yml pull  # Download the latest container images
docker-compose -f docker-compose.yml up  # Run the services

This will start the service and take over the terminal, printing log messages from all the services started through the docker-compose.yml file. If one instead wishes to keep that terminal available, or only show the logs relevant for the oteapi service, one can do:

docker-compose -f docker-compose.yml up -d  # Run the services detached

# Show logs and give back terminal
docker logs dlite-cuds-oteapi-1

# Show logs and follow them live
docker logs -f dlite-cuds-oteapi-1

Now, one can instantiate an otelib.OTEClient with "http://localhost:8080" (or using the PORT environment variable value instead of 8080 if it has been set) and test the strategies by supplying the correct configuration values.

Note, remember to update setup.cfg to list the plugin strategies - otherwise they will not be findable by the OTEAPI service.

License and copyright

DLite2CUDS is released under the MIT license with copyright © SINTEF.

Acknowledgment

DLite2CUDS has been created via the cookiecutter template for OTEAPI plugins.

DLite2CUDS has been supported by the following projects:

  • OntoTrans (2020-2024) that receives funding from the European Union’s Horizon 2020 Research and Innovation Programme, under Grant Agreement n. 862136.

  • VIPCOAT (2021-2025) receives funding from the European Union’s Horizon 2020 Research and Innovation Programme - DT-NMBP-11-2020 Open Innovation Platform for Materials Modelling, under Grant Agreement no: 952903.

  • OpenModel (2021-2025) receives funding from the European Union’s Horizon 2020 Research and Innovation Programme - DT-NMBP-11-2020 Open Innovation Platform for Materials Modelling, under Grant Agreement no: 953167.