Skip to content

Commit

Permalink
Merge branch 'ci/dependabot-updates' into dependabot/pip/ci/dependabo…
Browse files Browse the repository at this point in the history
…t-updates/mkdocstrings-python-legacy--approx-eq-0.23.0
  • Loading branch information
francescalb authored Oct 10, 2023
2 parents 38ce8f1 + 0930669 commit 4958406
Show file tree
Hide file tree
Showing 39 changed files with 951 additions and 442 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cd_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
publish:
name: External
uses: SINTEF/ci-cd/.github/workflows/[email protected].1
uses: SINTEF/ci-cd/.github/workflows/[email protected].2
if: github.repository == 'emmo-repo/EMMOntoPy' && startsWith(github.ref, 'refs/tags/v')
with:
git_username: EMMOntoPy Developers
Expand All @@ -16,7 +16,7 @@ jobs:

# Publish package
python_package: true
python_version_build: "3.7"
python_version_build: "3.9"
# We're mentioning only 'ontopy', since the version is set statically only in
# ontopy/__init__.py
package_dirs: ontopy
Expand All @@ -26,7 +26,7 @@ jobs:

# Update documentation
update_docs: true
python_version_docs: "3.7"
python_version_docs: "3.9"
doc_extras: "[docs]"
changelog_exclude_labels: dependencies

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_automerge_dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
update-dependabot-branch:
name: External
uses: SINTEF/ci-cd/.github/workflows/[email protected].1
uses: SINTEF/ci-cd/.github/workflows/[email protected].2
if: github.repository_owner == 'emmo-repo' && startsWith(github.event.pull_request.head.ref, 'dependabot/') && github.actor == 'dependabot[bot]'
secrets:
PAT: ${{ secrets.RELEASE_PAT }}
4 changes: 2 additions & 2 deletions .github/workflows/ci_cd_updated_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
updates-to-master:
name: External
uses: SINTEF/ci-cd/.github/workflows/[email protected].1
uses: SINTEF/ci-cd/.github/workflows/[email protected].2
if: github.repository_owner == 'emmo-repo'
with:
git_username: EMMOntoPy Developers
Expand All @@ -22,7 +22,7 @@ jobs:
package_dirs: |
emmopy
ontopy
python_version: "3.7"
python_version: "3.9"
doc_extras: "[docs]"
special_file_api_ref_options: "emmopy/emmocheck.py,show_bases: false"
landing_page_replacements: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
create-collected-pr:
name: External
uses: SINTEF/ci-cd/.github/workflows/[email protected].1
uses: SINTEF/ci-cd/.github/workflows/[email protected].2
if: github.repository_owner == 'emmo-repo'
with:
git_username: EMMOntoPy Developers
Expand All @@ -21,7 +21,7 @@ jobs:
pr_labels: dependencies,github_actions
extra_to_dos: "- [ ] Make sure that the PR is **squash** merged, with a sensible commit message."
update_pre-commit: true
python_version: "3.8"
python_version: "3.9"
install_extras: "[dev,docs]"
skip_pre-commit_hooks: pylint
secrets:
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ on:
jobs:
tests:
name: External
uses: SINTEF/ci-cd/.github/workflows/[email protected].1
uses: SINTEF/ci-cd/.github/workflows/[email protected].2
with:
# General
install_extras: "[dev,docs]"

# pre-commit
run_pre-commit: true
python_version_pre-commit: "3.8"
python_version_pre-commit: "3.9"
skip_pre-commit_hooks: pylint

# pylint
run_pylint: true
python_version_pylint_safety: "3.7"
python_version_pylint_safety: "3.9"
pylint_options: "--rcfile=pyproject.toml"
pylint_targets: "*.py tools emmopy ontopy"

Expand All @@ -42,13 +42,13 @@ jobs:
# Build distribution
run_build_package: true
python_version_package: "3.7"
python_version_package: "3.9"
build_cmd: "python -m build"

# Build documentation
# Exclude base classes in emmopy.emmocheck
run_build_docs: true
python_version_docs: "3.7"
python_version_docs: "3.9"
update_python_api_ref: true
update_docs_landing_page: true
package_dirs: |
Expand All @@ -71,7 +71,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand All @@ -91,7 +91,7 @@ jobs:
run: pytest -vvv --cov=ontopy --cov=emmopy --cov-report=xml --cov-report=term --doctest-modules

- name: Upload coverage to Codecov
if: matrix.python-version == '3.7' && github.repository == 'emmo-repo/EMMOntoPy'
if: matrix.python-version == '3.9' && github.repository == 'emmo-repo/EMMOntoPy'
uses: codecov/codecov-action@v3

# - name: Run vertical demo
Expand All @@ -115,12 +115,12 @@ jobs:
name: EMMO documentation (test using ontodoc)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python 3.7
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.7"
python-version: "3.9"

- name: Check Ubuntu version we are running under
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
# exclude: ^tests/.*$

- repo: https://github.com/SINTEF/ci-cd
rev: v2.4.0
rev: v2.5.0
hooks:
- id: docs-api-reference
args:
Expand Down
81 changes: 53 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,68 @@

# EMMOntoPy

*Python API for the Elemental Multiperspective Material Ontology ([EMMO]).*
*Library for representing and working with ontologies in Python.*

![CI tests](https://github.com/emmo-repo/EMMOntoPy/workflows/CI%20Tests/badge.svg)
[![PyPI version](https://badge.fury.io/py/EMMOntoPy.svg)](https://badge.fury.io/py/EMMOntoPy)
[![DOI](https://zenodo.org/badge/190286064.svg)](https://zenodo.org/badge/latestdoi/190286064)

> ***Note**: EMMOntoPy is a continuation of the EMMO-python project and the associated `emmo` Python package.
> To see the legacy versions go to [PyPI](https://pypi.org/project/EMMO/).*
This package is based on [Owlready2] and provides an intuitive representation of [EMMO] in Python.
It is available on [GitHub][EMMOntoPy] and on [PyPI][PyPI:EMMOntoPy] under the open source [BSD 3-Clause license](LICENSE.txt).

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`](docs/tools-instructions.md#emmocheck):
Checks an ontology against EMMO conventions.
- [`ontoversion`](docs/tools-instructions.md#ontoversion):
Prints ontology version number.
EMMOntoPy is a Python package based on the excellent [Owlready2], which provides a natural and intuitive representation of ontologies in Python.
EMMOntoPy extends Owlready2 and adds additional functionality, like accessing entities by label, reasoning with FaCT++ and parsing logical expressions in Manchester syntax.
It also includes a set of tools, like creating an ontology from an Excel sheet, generation of reference documentation of ontologies and visualisation of ontologies graphically.
EMMOntoPy is freely available for on GitHub and on PyPI under the permissive open source [BSD 3-Clause license](LICENSE.txt).

EMMOntoPy was originally developed to work effectively with the Elemental Multiperspective Material Ontology ([EMMO]) and EMMO-based domain ontologies.
It has now two sub-packages, `ontopy` and `emmopy`, where `ontopy` is a general package to work with any OWL ontology, while `emmopy` provides extra features that are specific to [EMMO].

Owlready2, and thereby also EMMOntoPy, represents OWL classes and individuals in Python as classes and instances.
OWL properties are represented as Python attributes.
Hence, it provides a new *dot* notation for representing ontologies as valid Python code.
The notation is simple and easy to understand and write for people with some knowledge of OWL and Python.
Since Python is a versatile programming language, Owlready2 does not only allow for representation of OWL ontologies, but also to work with them programmatically, including interpretation, modification and generation.
Some of the additional features provided by EMMOntoPy are are listed below:

## Access by label
In Owlready2 ontological entities, like classes, properties and individuals are accessed by the name-part of their IRI (i.e. everything that follows after the final slash or hash in the IRI).
This is very inconvenient for ontologies like EMMO or Wikidata, that identify ontological entities by long numerical names.
For instance, the name-part of the IRI of the Atom class in EMMO is ‘EMMO_eb77076b_a104_42ac_a065_798b2d2809ad’, which is neither human readable nor easy to write.
EMMOntoPy allows to access the entity via its label (or rather skos:prefLabel) ‘Atom’, which is much more user friendly.

## Turtle serialisation/deserialisation
The Terse RDF Triple Language (Turtle) is a common syntax and file format for representing ontologies.
EMMOntoPy adds support for reading and writing ontologies in turtle format.

## FaCT++ reasoning
Owlready2 has only support for reasoning with HermiT and Pellet.
EMMOntoPy adds additional support for the fast tableaux-based [FaCT++ reasoner] for description logics.

## Manchester syntax
Even though the Owlready2 dot notation is clear and easy to read and understand for people who know Python, it is a new syntax that may look foreign for people that are used to working with Protégé.
EMMOntoPy provides support to parse and serialise logical expressions in [Manchester syntax], making it possible to create tools that will be much more familiar to work with for people used to working with Protégé.

## Visualisation
EMMOntoPy provides a Python module for graphical visualisation of ontologies.
This module allows to graphically represent not only the taxonomy, but also restrictions and logical constructs.
The classes to include in the graph, can either be specified manually or inferred from the taxonomy (like all subclasses of a give class that are not a subclass of any class in a set of other classes).

## Tools
EMMOntoPy includes a small set of command-line tools implemented as Python scripts:
- [`ontoconvert`](docs/tools-instructions.md#ontoconvert):
Converts ontologies between different file formats.
It also supports some additional transformation during conversion, like running a reasoner, merging several ontological modules together (squashing), rename IRIs, generate catalogue file and automatic annotation of entities with their source IRI.
- [`ontograph`](docs/tools-instructions.md#ontograph):
Vertasile tool for visualising (parts of) an ontology.
Vertasile tool for visualising (parts of) an ontology, utilising the visualisation features mention above.
- [`ontodoc`](docs/tools-instructions.md#ontodoc):
Documents an ontology.
- [`ontoconvert`](docs/tools-instructions.md#ontoconvert):
Converts between ontology formats.
- [`excel2onto`](docs/tools-instructions.md#excel2onto):
Generate an EMMO-based ontology from an excel file.
It is useful for domain experts with limited knowledge of ontologies and that are not used to tools like Protégé.
- [`ontoversion`](docs/tools-instructions.md#ontoversion):
Prints ontology version number.
- [`emmocheck`](docs/tools-instructions.md#emmocheck):
A small test framework for checking the consistency of EMMO and EMMO-based domain ontologies and whether they confirm to the EMMO conventions.

Some examples of what you can do with EMMOntoPy includes:
## 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).
Expand Down Expand Up @@ -181,3 +204,5 @@ It has mainly been developed by [SINTEF](https://www.sintef.no/), specifically:
[Pygments]: https://pypi.org/project/Pygments/
[semver]: https://pypi.org/project/semver/
[rdflib]: https://pypi.org/project/rdflib/
[FaCT++]: http://owl.cs.manchester.ac.uk/tools/fact/
[Manchester syntax]: https://www.w3.org/TR/owl2-manchester-syntax/
2 changes: 1 addition & 1 deletion demo/horizontal/emmo2meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def get_description(self, cls):
"""Returns description for OWL class `cls` by combining its
annotations."""
if isinstance(cls, str):
cls = onto[cls]
cls = self.onto[cls]
descr = []
annotations = self.onto.get_annotations(cls)
if "definition" in annotations:
Expand Down
81 changes: 53 additions & 28 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,68 @@

# EMMOntoPy

*Python API for the Elemental Multiperspective Material Ontology ([EMMO]).*
*Library for representing and working with ontologies in Python.*

![CI tests](https://github.com/emmo-repo/EMMOntoPy/workflows/CI%20Tests/badge.svg)
[![PyPI version](https://badge.fury.io/py/EMMOntoPy.svg)](https://badge.fury.io/py/EMMOntoPy)
[![DOI](https://zenodo.org/badge/190286064.svg)](https://zenodo.org/badge/latestdoi/190286064)

> ***Note**: EMMOntoPy is a continuation of the EMMO-python project and the associated `emmo` Python package.
> To see the legacy versions go to [PyPI](https://pypi.org/project/EMMO/).*
This package is based on [Owlready2] and provides an intuitive representation of [EMMO] in Python.
It is available on [GitHub][EMMOntoPy] and on [PyPI][PyPI:EMMOntoPy] under the open source [BSD 3-Clause license](LICENSE.md).

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`](tools-instructions.md#emmocheck):
Checks an ontology against EMMO conventions.
- [`ontoversion`](tools-instructions.md#ontoversion):
Prints ontology version number.
EMMOntoPy is a Python package based on the excellent [Owlready2], which provides a natural and intuitive representation of ontologies in Python.
EMMOntoPy extends Owlready2 and adds additional functionality, like accessing entities by label, reasoning with FaCT++ and parsing logical expressions in Manchester syntax.
It also includes a set of tools, like creating an ontology from an Excel sheet, generation of reference documentation of ontologies and visualisation of ontologies graphically.
EMMOntoPy is freely available for on GitHub and on PyPI under the permissive open source [BSD 3-Clause license](LICENSE.md).

EMMOntoPy was originally developed to work effectively with the Elemental Multiperspective Material Ontology ([EMMO]) and EMMO-based domain ontologies.
It has now two sub-packages, `ontopy` and `emmopy`, where `ontopy` is a general package to work with any OWL ontology, while `emmopy` provides extra features that are specific to [EMMO].

Owlready2, and thereby also EMMOntoPy, represents OWL classes and individuals in Python as classes and instances.
OWL properties are represented as Python attributes.
Hence, it provides a new *dot* notation for representing ontologies as valid Python code.
The notation is simple and easy to understand and write for people with some knowledge of OWL and Python.
Since Python is a versatile programming language, Owlready2 does not only allow for representation of OWL ontologies, but also to work with them programmatically, including interpretation, modification and generation.
Some of the additional features provided by EMMOntoPy are are listed below:

## Access by label
In Owlready2 ontological entities, like classes, properties and individuals are accessed by the name-part of their IRI (i.e. everything that follows after the final slash or hash in the IRI).
This is very inconvenient for ontologies like EMMO or Wikidata, that identify ontological entities by long numerical names.
For instance, the name-part of the IRI of the Atom class in EMMO is ‘EMMO_eb77076b_a104_42ac_a065_798b2d2809ad’, which is neither human readable nor easy to write.
EMMOntoPy allows to access the entity via its label (or rather skos:prefLabel) ‘Atom’, which is much more user friendly.

## Turtle serialisation/deserialisation
The Terse RDF Triple Language (Turtle) is a common syntax and file format for representing ontologies.
EMMOntoPy adds support for reading and writing ontologies in turtle format.

## FaCT++ reasoning
Owlready2 has only support for reasoning with HermiT and Pellet.
EMMOntoPy adds additional support for the fast tableaux-based [FaCT++ reasoner] for description logics.

## Manchester syntax
Even though the Owlready2 dot notation is clear and easy to read and understand for people who know Python, it is a new syntax that may look foreign for people that are used to working with Protégé.
EMMOntoPy provides support to parse and serialise logical expressions in [Manchester syntax], making it possible to create tools that will be much more familiar to work with for people used to working with Protégé.

## Visualisation
EMMOntoPy provides a Python module for graphical visualisation of ontologies.
This module allows to graphically represent not only the taxonomy, but also restrictions and logical constructs.
The classes to include in the graph, can either be specified manually or inferred from the taxonomy (like all subclasses of a give class that are not a subclass of any class in a set of other classes).

## Tools
EMMOntoPy includes a small set of command-line tools implemented as Python scripts:
- [`ontoconvert`](tools-instructions.md#ontoconvert):
Converts ontologies between different file formats.
It also supports some additional transformation during conversion, like running a reasoner, merging several ontological modules together (squashing), rename IRIs, generate catalogue file and automatic annotation of entities with their source IRI.
- [`ontograph`](tools-instructions.md#ontograph):
Vertasile tool for visualising (parts of) an ontology.
Vertasile tool for visualising (parts of) an ontology, utilising the visualisation features mention above.
- [`ontodoc`](tools-instructions.md#ontodoc):
Documents an ontology.
- [`ontoconvert`](tools-instructions.md#ontoconvert):
Converts between ontology formats.
- [`excel2onto`](tools-instructions.md#excel2onto):
Generate an EMMO-based ontology from an excel file.
It is useful for domain experts with limited knowledge of ontologies and that are not used to tools like Protégé.
- [`ontoversion`](tools-instructions.md#ontoversion):
Prints ontology version number.
- [`emmocheck`](tools-instructions.md#emmocheck):
A small test framework for checking the consistency of EMMO and EMMO-based domain ontologies and whether they confirm to the EMMO conventions.

Some examples of what you can do with EMMOntoPy includes:
## 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).
Expand Down Expand Up @@ -181,3 +204,5 @@ It has mainly been developed by [SINTEF](https://www.sintef.no/), specifically:
[Pygments]: https://pypi.org/project/Pygments/
[semver]: https://pypi.org/project/semver/
[rdflib]: https://pypi.org/project/rdflib/
[FaCT++]: http://owl.cs.manchester.ac.uk/tools/fact/
[Manchester syntax]: https://www.w3.org/TR/owl2-manchester-syntax/
Loading

0 comments on commit 4958406

Please sign in to comment.