Skip to main content

Python reference API for the Elementary MultiperspectiveMaterial Ontology.

Project description

EMMOntoPy

Python API for the Elemental Multiperspective Material Ontology (EMMO).

CI tests PyPI version

Note: EMMOntoPy is a continuation of the EMMO-python project and the associated emmo Python package. To see the legacy versions go to PyPI.

This package is based on Owlready2 and provides an intuitive representation of EMMO in Python. It is available on GitHub and on PyPI under the open source BSD 3-Clause license.

The Elemental Multiperspective Material Ontology (EMMO) is an ongoing effort to create an ontology that takes into account fundamental concepts of physics, chemistry and materials science and is designed to pave the road for semantic interoperability. The aim of EMMO is to be generic and provide a common ground for describing materials, models and data that can be adapted by all domains.

EMMO is formulated using OWL. EMMOntoPy is a Python API for using EMMO to solving real problems. By using the excellent Python package Owlready2, EMMOntoPy provides a natural representation of EMMO in Python. On top of that EMMOntoPy provides:

  • Access by label (as well as by names, important since class and property names in EMMO are based on UUIDs).
  • Test suite for EMMO-based ontologies.
  • Generation of graphs.
  • Generation of documentation.
  • Command-line tools:
    • emmocheck: Checks an ontology against EMMO conventions.
    • ontoversion: Prints ontology version number.
    • ontograph: Vertasile tool for visualising (parts of) an ontology.
    • ontodoc: Documents an ontology.
    • ontoconvert: Converts between ontology formats.

Some examples of what you can do with EMMOntoPy includes:

  • Access and query RDF-based ontologies from your application. This includes several different flavors of RDF (OWL, Turtle (ttl), and more).

  • Access and query EMMO-based ontologies from your application.

  • Extend EMMO with new domain or application ontologies. This can be done both statically with easy readable Python code or dynamically within your application.

  • Generate graphs and documentation of your ontologies. EMMOntoPy includes ontodoc: A dedicated command line tool for this. You find it in the tools/ sub directory.

  • Check that an EMMO-based domain or application ontology adhere to the conventions of EMMO.

  • Interactively explore an ontology in any Python interpreter, e.g., IPython. Tab-completion makes exploration easy and fast. Below is an example of an IPython session where we check the relations of Matter in EMMO utilizing the emmopy.get_emmo function:

    In [1]: from emmopy import get_emmo
    
    In [2]: emmo = get_emmo()
    
    In [3]: emmo.Matter
    Out[3]: physicalistic.Matter
    
    In [4]: emmo.Matter.is_a
    Out[4]:
    [physicalistic.Physicalistic,
      physical.Physical,
      mereotopology.hasPart.some(physicalistic.Massive),
      physical.hasTemporalPart.only(physicalistic.Matter)]
    

Documentation and examples

The Owlready2 documentation is a good starting point. The EMMOntoPy package also has its own dedicated documentation.

This includes a few examples and demos:

  • demo/vertical shows an example of how EMMO may be used to achieve vertical interoperability. The file define-ontology.py provides a good example for how an EMMO-based application ontology can be defined in Python.

  • demo/horizontal shows an example of how EMMO may be used to achieve horizontal interoperability. This demo also shows how you can use EMMOntoPy to represent your ontology with the low-level metadata framework DLite. In addition to achieve interoperability, as shown in the demo, DLite also allow you to automatically generate C or Fortran code base on your ontology.

  • examples/emmodoc shows how the documentation of EMMO is generated using the ontodoc tool.

Installation

Install with

pip install EMMOntoPy

Required Dependencies

Optional Dependencies

  • Graphviz: Needed for graph generation. With support for generation pdf, png and svg figures for tests and generation of documentation automatically (ontodoc).

  • pandoc: Only used for generated documentation from markdown to nicely formatted html or pdf. Tested with v2.1.2.

  • pdfLaTeX or XeLaTeX and the upgreek LaTeX package (included in texlive-was on RetHat-based distributions and texlive-latex-extra on Ubuntu) for generation of pdf documentation. If your ontology contains exotic unicode characters, we recommend XeLaTeX.

  • Java. Needed for reasoning.

  • Optional Python packages:

    • graphviz: Generation of documentation and graphs.
    • PyYAML: Required for generating documentation with pandoc.
    • blessings: Clean output for emmocheck.
    • Pygments: Coloured output for emmocheck.
    • rdflib: Required for ontoversion-tool.
    • semver: Required for ontoversion-tool.
    • pydot: Used for generating graphs. Will be deprecated.
    • pyparsing: Used for parsing Manchester syntax

See docs/docker-instructions.md for how to build a docker image.

Known issues

  • Invalid serialising to turtle: Due to rdflib issue #1043 ontoconvert may produce invalid turtle output (if your ontology contains real literals using scientific notation without a dot in the mantissa). This issue was fixed after the release of rdflib 5.0.0. Hence, install the latest rdflib from PyPI (pip install --upgrade rdflib) or directly from the source code repository: GitHub if you need to serialise to turtle.

Attributions and credits

EMMOntoPy is maintained by EMMC-ASBL. It has mainly been developed by SINTEF, specifically:

Contributing projects

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

EMMOntoPy-0.2.0.tar.gz (18.1 MB view details)

Uploaded Source

Built Distribution

EMMOntoPy-0.2.0-py3-none-any.whl (18.1 MB view details)

Uploaded Python 3

File details

Details for the file EMMOntoPy-0.2.0.tar.gz.

File metadata

  • Download URL: EMMOntoPy-0.2.0.tar.gz
  • Upload date:
  • Size: 18.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for EMMOntoPy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fe308a0164f935f0cbd1ab469416286731de91678f21c242cab4ba13e8074c44
MD5 b52a7c93a2a47151b39f0c64a410d390
BLAKE2b-256 64579bdf718307fdaebf587d5775db024033c0c59b6796fee571b0138e8d2880

See more details on using hashes here.

File details

Details for the file EMMOntoPy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: EMMOntoPy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for EMMOntoPy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 843b8601fa7b70ed2bd87e0acdfe5f4270893245aa77dec6fa881562046a9ebb
MD5 abc8a15e3d473ad21934aa305c86b83a
BLAKE2b-256 5c3fbeb66a34566d131b7e39fc523e4e583ea0d1e5ca4decaf6e4e6c77b3ed95

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page