Skip to content

Commit

Permalink
remove "annotate inferred axioms" parameter, edit README
Browse files Browse the repository at this point in the history
  • Loading branch information
muddymudskipper committed Jul 1, 2024
1 parent b66f3c5 commit 70932eb
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 28 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

### Changed

- completed validation for IRI parameters
- "Annnotate inferred subclass axioms" is now not an advanced parameter
- complete validation for IRI parameters
- Remove "Annnotate inferred subclass axioms" parameter

## [1.0.0alpha3] 2024-06-28

Expand Down
2 changes: 1 addition & 1 deletion README-public.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cmem-plugin-reason

This [eccenca](https://eccenca.com) [Corporate Memory](https://documentation.eccenca.com) workflow plugin performs reasoning using [ROBOT](http://robot.obolibrary.org/). It takes an OWL ontology and a data graph as inputs and writes the reasoning result to a specified graph.
This [eccenca](https://eccenca.com) [Corporate Memory](https://documentation.eccenca.com) workflow plugin performs reasoning using [ROBOT](http://robot.obolibrary.org/).

ROBOT is published under the [BSD 3-Clause "New" or "Revised" License](https://choosealicense.com/licenses/bsd-3-clause/).
Copyright © 2015, the Authors
Expand Down
57 changes: 53 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

# cmem-plugin-reason

Reasoning with ROBOT

This eccenca Corporate Memory workflow plugin performs reasoning using [ROBOT](http://robot.obolibrary.org/). It takes an OWL ontology and a data graph as inputs and writes the reasoning result to a specified graph.
This [eccenca](https://eccenca.com) [Corporate Memory](https://documentation.eccenca.com) workflow plugin bundle contains plugins performing reasoning (Reason) and ontology consistency checking (Validate) using [ROBOT](http://robot.obolibrary.org/).

[![eccenca Corporate Memory](https://img.shields.io/badge/eccenca-Corporate%20Memory-orange)](https://documentation.eccenca.com) [![workflow](https://github.com/eccenca/cmem-plugin-pyshacl/actions/workflows/check.yml/badge.svg)](https://github.com/eccenca/cmem-plugin-pyshacl/actions) [![pypi version](https://img.shields.io/pypi/v/cmem-plugin-reason)](https://pypi.org/project/cmem-plugin-reason/) [![license](https://img.shields.io/pypi/l/cmem-plugin-reason)](https://pypi.org/project/cmem-plugin-reasom)

Expand All @@ -29,6 +27,7 @@ Alternatively, the _build_ and _installation_ process can be initiated with the
➜ task deploy
```

# Reason
## Options

### Data graph IRI
Expand All @@ -46,7 +45,6 @@ The IRI of the output graph for the reasoning result.

:warning: Existing graphs will be overwritten.


### Reasoner

The following reasoner options are supported:
Expand Down Expand Up @@ -84,3 +82,54 @@ parameters to include inferred axiom generators:
- ObjectPropertyRange
- ObjectPropertyDomain

### Maximum RAM Percentage

Maximum heap size for the Java virtual machine in the DI container running the reasoning process.

:warning: Setting the percentage too high may result in an out of memory error.

# Validate

In case ontology inconsistencies are found, the plugin outputs the explanation as text in Markdown format using the path "text".

## Options

### Ontology graph IRI

The IRI of the input ontology graph. The graph IRI is selected from a list of graphs of type`owl:Ontology`.

### Reasoner

The following reasoner options are supported:
- [ELK](https://code.google.com/p/elk-reasoner/) (elk)
- [Expression Materializing Reasoner](http://static.javadoc.io/org.geneontology/expression-materializing-reasoner/0.1.3/org/geneontology/reasoner/ExpressionMaterializingReasoner.html) (emr)
- [HermiT](http://www.hermit-reasoner.com/) (hermit)
- [JFact](http://jfact.sourceforge.net/) (jfact)
- [Structural Reasoner](http://owlcs.github.io/owlapi/apidocs_4/org/semanticweb/owlapi/reasoner/structural/StructuralReasoner.html) (structural)
- [Whelk](https://github.com/balhoff/whelk) (whelk)

### Produce output graph

If enabled, an explanation graph is created.

### Output graph IRI

The IRI of the output graph for the reasoning result.

:warning: Existing graphs will be overwritten.

### Write markdown explanation file

If enabled, an explanation markdown file is written to the project.

:warning: Existing files will be overwritten.

### Stop at inconsistencies

Raise an error if inconsistencies are found. If enabled, the plugin does not output entities.

### Maximum RAM Percentage

Maximum heap size for the Java virtual machine in the DI container running the reasoning process.

:warning: Setting the percentage too high may result in an out of memory error.
18 changes: 1 addition & 17 deletions cmem_plugin_reason/plugin_reason.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,12 @@
description="",
default_value=False,
),
PluginParameter(
param_type=BoolParameterType(),
name="annotate_inferred_axioms",
label="Annnotate inferred subclass axioms",
description="⚠️ This parameter can only be enabled if the only enabled axiom generator "
"is SubClass.",
default_value=False,
),
],
)
class ReasonPlugin(WorkflowPlugin):
"""Reason plugin"""

def __init__( # noqa: PLR0913, C901
def __init__( # noqa: PLR0913
self,
data_graph_iri: str = "",
ontology_graph_iri: str = "",
Expand All @@ -192,7 +184,6 @@ def __init__( # noqa: PLR0913, C901
sub_class: bool = True,
sub_data_property: bool = False,
sub_object_property: bool = False,
annotate_inferred_axioms: bool = False,
max_ram_percentage: int = MAX_RAM_PERCENTAGE_DEFAULT,
) -> None:
self.axioms = {
Expand Down Expand Up @@ -226,11 +217,6 @@ def __init__( # noqa: PLR0913, C901
errors += 'Invalid value for parameter "Reasoner". '
if True not in self.axioms.values():
errors += "No axiom generator selected. "
if annotate_inferred_axioms and [k for k, v in self.axioms.items() if v] != ["SubClass"]:
errors += (
'Parameter "Annnotate inferred subclass axioms" can only be enabled if the only '
"enabled axiom generator is SubClass. "
)
if max_ram_percentage not in range(1, 101):
errors += 'Invalid value for parameter "Maximum RAM Percentage". '
if errors:
Expand All @@ -239,7 +225,6 @@ def __init__( # noqa: PLR0913, C901
self.ontology_graph_iri = ontology_graph_iri
self.result_graph_iri = result_graph_iri
self.reasoner = reasoner
self.annotate_inferred_axioms = str(annotate_inferred_axioms).lower()
self.max_ram_percentage = max_ram_percentage
self.temp = f"reason_{uuid4().hex}"

Expand Down Expand Up @@ -268,7 +253,6 @@ def reason(self, graphs: dict) -> None:
"--collapse-import-closure false "
f"reason --reasoner {self.reasoner} "
f'--axiom-generators "{axioms}" '
f"--annotate-inferred-axioms {self.annotate_inferred_axioms} "
f"--include-indirect true "
f"--exclude-duplicate-axioms true "
f"--exclude-owl-thing true "
Expand Down
5 changes: 3 additions & 2 deletions cmem_plugin_reason/plugin_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
param_type=BoolParameterType(),
name="write_md",
label="Write Markdown explanation file",
description="Write Markdownn file with explanation to project.",
description="Write Markdown file with explanation to project. ⚠️ Existing files will "
"be overwritten.",
default_value=False,
),
PluginParameter(
Expand All @@ -65,7 +66,7 @@
name="output_graph_iri",
label="Output graph IRI",
description="The IRI of the output graph for the inconsistency validation. ⚠️ Existing "
"graph will be overwritten.",
"graphs will be overwritten.",
),
PluginParameter(
param_type=StringParameterType(),
Expand Down
4 changes: 2 additions & 2 deletions cmem_plugin_reason/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def convert_iri_to_filename(value: str) -> str:
return value + ".nt"


def create_xml_catalog_file(temp: str, graphs: dict) -> None:
def create_xml_catalog_file(dir_: str, graphs: dict) -> None:
"""Create XML catalog file"""
file_name = Path(temp) / "catalog-v001.xml"
file_name = Path(dir_) / "catalog-v001.xml"
catalog = Element("catalog")
catalog.set("prefer", "public")
catalog.set("xmlns", "urn:oasis:names:tc:entity:xmlns:xml:catalog")
Expand Down

0 comments on commit 70932eb

Please sign in to comment.