diff --git a/CHANGELOG.md b/CHANGELOG.md index fd55505..092309d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README-public.md b/README-public.md index b6d5a71..4500bbf 100644 --- a/README-public.md +++ b/README-public.md @@ -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 diff --git a/README.md b/README.md index dc019ad..370a27b 100644 --- a/README.md +++ b/README.md @@ -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) @@ -29,6 +27,7 @@ Alternatively, the _build_ and _installation_ process can be initiated with the ➜ task deploy ``` +# Reason ## Options ### Data graph IRI @@ -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: @@ -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. \ No newline at end of file diff --git a/cmem_plugin_reason/plugin_reason.py b/cmem_plugin_reason/plugin_reason.py index 31c8399..ab5908c 100644 --- a/cmem_plugin_reason/plugin_reason.py +++ b/cmem_plugin_reason/plugin_reason.py @@ -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 = "", @@ -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 = { @@ -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: @@ -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}" @@ -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 " diff --git a/cmem_plugin_reason/plugin_validate.py b/cmem_plugin_reason/plugin_validate.py index fa55ad3..eea52ca 100644 --- a/cmem_plugin_reason/plugin_validate.py +++ b/cmem_plugin_reason/plugin_validate.py @@ -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( @@ -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(), diff --git a/cmem_plugin_reason/utils.py b/cmem_plugin_reason/utils.py index c0e37fa..eea73a7 100644 --- a/cmem_plugin_reason/utils.py +++ b/cmem_plugin_reason/utils.py @@ -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")