diff --git a/cmem_plugin_reason/plugin_reason.py b/cmem_plugin_reason/plugin_reason.py index 4360179..176836b 100644 --- a/cmem_plugin_reason/plugin_reason.py +++ b/cmem_plugin_reason/plugin_reason.py @@ -19,6 +19,7 @@ from cmem_plugin_base.dataintegration.ports import FixedNumberOfInputs, FixedSchemaPort from cmem_plugin_base.dataintegration.types import BoolParameterType from cmem_plugin_base.dataintegration.utils import setup_cmempy_user_access +from inflection import underscore from urllib3.exceptions import InsecureRequestWarning from cmem_plugin_reason.utils import ( @@ -245,20 +246,7 @@ def __init__( # noqa: PLR0913, C901 errors += 'Invalid value for parameter "Maximum RAM Percentage". ' if errors: raise ValueError(errors[:-1]) - self.sub_class = sub_class - self.equivalent_class = equivalent_class - self.disjoint_classes = disjoint_classes - self.data_property_characteristic = data_property_characteristic - self.equivalent_data_properties = equivalent_data_properties - self.sub_data_property = sub_data_property - self.class_assertion = class_assertion - self.property_assertion = property_assertion - self.equivalent_object_property = equivalent_object_property - self.inverse_object_properties = inverse_object_properties - self.object_property_characteristic = object_property_characteristic - self.sub_object_property = sub_object_property - self.object_property_range = object_property_range - self.object_property_domain = object_property_domain + self.data_graph_iri = data_graph_iri self.ontology_graph_iri = ontology_graph_iri self.output_graph_iri = output_graph_iri @@ -267,6 +255,9 @@ def __init__( # noqa: PLR0913, C901 self.input_profiles = input_profiles self.max_ram_percentage = max_ram_percentage + for k, v in self.axioms.items(): + self.__dict__[underscore(k)] = v + if validate_profile and input_profiles: self.input_ports = FixedNumberOfInputs([FixedSchemaPort(self.generate_input_schema())]) else: diff --git a/cmem_plugin_reason/plugin_validate.py b/cmem_plugin_reason/plugin_validate.py index e5ae683..475ff32 100644 --- a/cmem_plugin_reason/plugin_validate.py +++ b/cmem_plugin_reason/plugin_validate.py @@ -144,13 +144,11 @@ def explain(self, graphs: dict) -> None: """Reason""" data_location = f"{self.temp}/{graphs[self.ontology_graph_iri]}" utctime = str(datetime.fromtimestamp(int(time()), tz=UTC))[:-6].replace(" ", "T") + "Z" - cmd = ( f'explain --input "{data_location}" ' f"--reasoner {self.reasoner} -M inconsistency " f'--explanation "{self.temp}/{self.md_filename}"' ) - if self.output_graph_iri: cmd += ( f' annotate --ontology-iri "{self.output_graph_iri}" ' @@ -161,7 +159,6 @@ def explain(self, graphs: dict) -> None: f'--typed-annotation dc:created "{utctime}" xsd:dateTime ' f'--output "{self.temp}/output.ttl"' ) - response = robot(cmd, self.max_ram_percentage) if response.returncode != 0: if response.stdout: diff --git a/poetry.lock b/poetry.lock index 627c38f..2d5c841 100644 --- a/poetry.lock +++ b/poetry.lock @@ -316,6 +316,17 @@ files = [ {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, ] +[[package]] +name = "inflection" +version = "0.5.1" +description = "A port of Ruby on Rails inflector to Python" +optional = false +python-versions = ">=3.5" +files = [ + {file = "inflection-0.5.1-py2.py3-none-any.whl", hash = "sha256:f38b2b640938a4f35ade69ac3d053042959b62a0f1076a5bbaa1b9526605a8a2"}, + {file = "inflection-0.5.1.tar.gz", hash = "sha256:1a29730d366e996aaacffb2f1f1cb9593dc38e2ddd30c91250c6dde09ea9b417"}, +] + [[package]] name = "iniconfig" version = "2.0.0" @@ -1080,13 +1091,13 @@ files = [ [[package]] name = "textual" -version = "0.75.1" +version = "0.76.0" description = "Modern Text User Interface framework" optional = false python-versions = "<4.0.0,>=3.8.1" files = [ - {file = "textual-0.75.1-py3-none-any.whl", hash = "sha256:7edb1196753feae79890daa2287bc3180ebba2cbf63f59f2a160991325b020f2"}, - {file = "textual-0.75.1.tar.gz", hash = "sha256:3f0b53fe6119aa64853c7e60ced4d4e16fb23c83dee1e0fd19eddb3f2639c02e"}, + {file = "textual-0.76.0-py3-none-any.whl", hash = "sha256:e2035609c889dba507d34a5d7b333f1c8c53a29fb170962cb92101507663517a"}, + {file = "textual-0.76.0.tar.gz", hash = "sha256:b12e8879d591090c0901b5cb8121d086e28e677353b368292d3865ec99b83b70"}, ] [package.dependencies] @@ -1156,4 +1167,4 @@ crypto-eth-addresses = ["eth-hash[pycryptodome] (>=0.7.0)"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "91185650bb2b1c410b5d4927d0bac77b10393064c5052e199219c82385fbfda5" +content-hash = "4df369a43e71446c9cbc562df56387e5f6607d84851c42188d3799874a8848bf" diff --git a/pyproject.toml b/pyproject.toml index 27eac91..9e6ef0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ validators = "^0.33.0" pathvalidate = "^3.2.0" defusedxml = "^0.7.1" urllib3 = "^2.2.2" +inflection = "^0.5.1" [tool.poetry.dependencies.cmem-plugin-base] version = "^4.5.0"