Skip to content

Commit

Permalink
do not create output path "profile" if profile validation disabled (V…
Browse files Browse the repository at this point in the history
…alidate)
  • Loading branch information
muddymudskipper committed Jul 8, 2024
1 parent 9c8e5c4 commit fac6994
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
15 changes: 9 additions & 6 deletions cmem_plugin_reason/plugin_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def get_graphs(self, graphs: dict, context: ExecutionContext) -> None:
setup_cmempy_user_access(context.user)
file.write(get(graph).text)

def validate(self, graphs: dict) -> None:
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"
Expand Down Expand Up @@ -194,18 +194,21 @@ def add_profiles(self, valid_profiles: list) -> list:

def make_entities(self, text: str, valid_profiles: list) -> Entities:
"""Make entities"""
values = [[text]]
paths = [EntityPath(path="markdown")]
if self.validate_profile:
values.append(valid_profiles)
paths.append(EntityPath(path="profile"))
entities = [
Entity(
uri="https://eccenca.com/plugin_validateontology/result",
values=[[text], valid_profiles],
values=values,
),
]

schema = EntitySchema(
type_uri="https://eccenca.com/plugin_validateontology/type",
paths=[EntityPath(path="markdown"), EntityPath(path="profile")],
paths=paths,
)

return Entities(entities=entities, schema=schema)

def execute(self, inputs: tuple, context: ExecutionContext) -> Entities | None: # noqa: ARG002
Expand All @@ -214,7 +217,7 @@ def execute(self, inputs: tuple, context: ExecutionContext) -> Entities | None:
graphs = get_graphs_tree((self.ontology_graph_iri,))
self.get_graphs(graphs, context)
create_xml_catalog_file(self.temp, graphs)
self.validate(graphs)
self.explain(graphs)

if self.produce_graph:
setup_cmempy_user_access(context.user)
Expand Down
8 changes: 4 additions & 4 deletions cmem_plugin_reason/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
param_type=IntParameterType(),
name="max_ram_percentage",
label="Maximum RAM Percentage",
description="Maximum heap size for the Java virtual machine in the DI container running the "
"reasoning process. ⚠️ Setting the percentage too high may result in an out of memory error.",
description="""Maximum heap size for the Java virtual machine in the DI container running the
reasoning process. ⚠️ Setting the percentage too high may result in an out of memory error.""",
default_value=MAX_RAM_PERCENTAGE_DEFAULT,
advanced=True,
)
Expand All @@ -65,8 +65,8 @@
param_type=BoolParameterType(),
name="validate_profile",
label="Validate OWL2 profiles",
description="""Validate the input ontology against OWL profiles (DL, EL, QL, RL, and
Full) and annotate the result graph.""",
description="""Validate the input ontology against OWL profiles (DL, EL, QL, RL, and Full) and
annotate the result graph.""",
default_value=False,
)

Expand Down

0 comments on commit fac6994

Please sign in to comment.