From 54984ecb71c8013ca6f37a95d325857a6331b00b Mon Sep 17 00:00:00 2001 From: muddymudskipper Date: Fri, 5 Jul 2024 10:13:34 +0100 Subject: [PATCH] fix validate profile robot command --- cmem_plugin_reason/plugin_reason.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/cmem_plugin_reason/plugin_reason.py b/cmem_plugin_reason/plugin_reason.py index 314a381..09682b3 100644 --- a/cmem_plugin_reason/plugin_reason.py +++ b/cmem_plugin_reason/plugin_reason.py @@ -312,23 +312,24 @@ def validate_profile(self, graphs: dict) -> None: valid_profiles = [] for profile in ("EL", "RL", "QL", "DL", "Full"): cmd = ( - f"java -jar cmem_plugin_reason/bin/robot.jar validate-profile --profile {profile} " - f"--input {ontology_location}" + f"java -XX:MaxRAMPercentage={self.max_ram_percentage} -jar {ROBOT} " + f"validate-profile --profile {profile} --input {ontology_location}" ) response = run(shlex.split(cmd), check=False, capture_output=True) # noqa: S603 - if response.stdout[-43:] == b"[Ontology and imports closure in profile]\n\n": + if response.stdout.endswith(b"[Ontology and imports closure in profile]\n\n"): valid_profiles.append(profile) - profiles = '", "'.join(valid_profiles) - query = f""" - INSERT DATA {{ - GRAPH <{self.output_graph_iri}> {{ - <{self.ontology_graph_iri}> - "{profiles}" . + if valid_profiles: + profiles = '", "'.join(valid_profiles) + query = f""" + INSERT DATA {{ + GRAPH <{self.output_graph_iri}> {{ + <{self.ontology_graph_iri}> + "{profiles}" . + }} }} - }} - """ - post(query=query) + """ + post(query=query) def execute(self, inputs: tuple, context: ExecutionContext) -> None: # noqa: ARG002 """`Execute plugin"""