diff --git a/cmem_plugin_reason/plugin_reason.py b/cmem_plugin_reason/plugin_reason.py index e9cfcc4..7396ee8 100644 --- a/cmem_plugin_reason/plugin_reason.py +++ b/cmem_plugin_reason/plugin_reason.py @@ -294,9 +294,8 @@ def reason(self, graphs: dict) -> None: f"--language-annotation rdfs:comment " f'"Reasoning result set of <{self.data_graph_iri}> and ' f'<{self.ontology_graph_iri}>" en ' - f'--link-annotation prov:wasDerivedFrom "{self.data_graph_iri}" ' - f"--link-annotation prov:wasDerivedFrom " - f'"{self.ontology_graph_iri}" ' + f'--link-annotation dc:source "{self.data_graph_iri}" ' + f'--link-annotation dc:source "{self.ontology_graph_iri}" ' f'--typed-annotation dc:created "{utctime}" xsd:dateTime ' f'--output "{self.temp}/result.ttl"' ) diff --git a/cmem_plugin_reason/plugin_validate.py b/cmem_plugin_reason/plugin_validate.py index 60ba407..4b1d951 100644 --- a/cmem_plugin_reason/plugin_validate.py +++ b/cmem_plugin_reason/plugin_validate.py @@ -156,7 +156,7 @@ def explain(self, graphs: dict) -> None: f'--language-annotation rdfs:label "Ontology Validation Result {utctime}" en ' f"--language-annotation rdfs:comment " f'"Ontology validation of <{self.ontology_graph_iri}>" en ' - f'--link-annotation prov:wasDerivedFrom "{self.ontology_graph_iri}" ' + f'--link-annotation dc:source "{self.ontology_graph_iri}" ' f'--typed-annotation dc:created "{utctime}" xsd:dateTime ' f'--output "{self.temp}/output.ttl"' ) diff --git a/cmem_plugin_reason/utils.py b/cmem_plugin_reason/utils.py index 9eb29e9..0cc8b7f 100644 --- a/cmem_plugin_reason/utils.py +++ b/cmem_plugin_reason/utils.py @@ -1,9 +1,7 @@ """Common constants and functions""" import json -import re import shlex -import unicodedata from collections import OrderedDict from pathlib import Path from secrets import token_hex @@ -70,16 +68,6 @@ ) -def convert_iri_to_filename(value: str) -> str: - """Convert IRI to filename""" - value = unicodedata.normalize("NFKD", value).encode("ascii", "ignore").decode("ascii") - value = re.sub(r"\.", "_", value.lower()) - value = re.sub(r"/", "_", value.lower()) - value = re.sub(r"[^\w\s-]", "", value.lower()) - value = re.sub(r"[-\s]+", "-", value).strip("-_") - return value + ".nt" - - def create_xml_catalog_file(dir_: str, graphs: dict) -> None: """Create XML catalog file""" file_name = Path(dir_) / "catalog-v001.xml" @@ -102,12 +90,12 @@ def get_graphs_tree(graph_iris: tuple) -> dict: graphs = {} for graph_iri in graph_iris: if graph_iri not in graphs: - graphs[graph_iri] = convert_iri_to_filename(graph_iri) + graphs[graph_iri] = f"{token_hex(8)}.nt" tree = get_graph_import_tree(graph_iri) for value in tree["tree"].values(): for iri in value: if iri not in graphs: - graphs[iri] = convert_iri_to_filename(iri) + graphs[iri] = f"{token_hex(8)}.nt" return graphs @@ -132,7 +120,7 @@ def post_provenance(plugin: WorkflowPlugin, prov: dict | None) -> None: insert_query = f""" INSERT DATA {{ GRAPH <{plugin.output_graph_iri}> {{ - <{plugin.output_graph_iri}> + <{plugin.output_graph_iri}> <{prov["plugin_iri"]}> . <{prov["plugin_iri"]}> a <{prov["plugin_type"]}>, . diff --git a/tests/test_elk.ttl b/tests/test_elk.ttl index 1323423..d848de9 100644 --- a/tests/test_elk.ttl +++ b/tests/test_elk.ttl @@ -4,14 +4,14 @@ @prefix xml: . @prefix xsd: . @prefix rdfs: . -@prefix prov: . +@prefix dc: . @prefix vocab: . @base . rdf:type owl:Ontology ; owl:imports vocab: ; rdfs:comment "Reasoning result set of and "@en ; - prov:wasDerivedFrom + dc:source , . ################################################################# diff --git a/tests/test_emr.ttl b/tests/test_emr.ttl index 9b64ec7..8a0f1f2 100644 --- a/tests/test_emr.ttl +++ b/tests/test_emr.ttl @@ -4,14 +4,14 @@ @prefix xml: . @prefix xsd: . @prefix rdfs: . -@prefix prov: . +@prefix dc: . @prefix vocab: . @base . rdf:type owl:Ontology ; owl:imports vocab: ; rdfs:comment "Reasoning result set of and "@en ; - prov:wasDerivedFrom + dc:source , . ################################################################# diff --git a/tests/test_hermit.ttl b/tests/test_hermit.ttl index 014cd0a..173d935 100644 --- a/tests/test_hermit.ttl +++ b/tests/test_hermit.ttl @@ -4,14 +4,14 @@ @prefix xml: . @prefix xsd: . @prefix rdfs: . -@prefix prov: . +@prefix dc: . @prefix vocab: . @base . rdf:type owl:Ontology ; owl:imports vocab: ; rdfs:comment "Reasoning result set of and "@en ; - prov:wasDerivedFrom + dc:source , . ################################################################# diff --git a/tests/test_jfact.ttl b/tests/test_jfact.ttl index 014cd0a..173d935 100644 --- a/tests/test_jfact.ttl +++ b/tests/test_jfact.ttl @@ -4,14 +4,14 @@ @prefix xml: . @prefix xsd: . @prefix rdfs: . -@prefix prov: . +@prefix dc: . @prefix vocab: . @base . rdf:type owl:Ontology ; owl:imports vocab: ; rdfs:comment "Reasoning result set of and "@en ; - prov:wasDerivedFrom + dc:source , . ################################################################# diff --git a/tests/test_structural.ttl b/tests/test_structural.ttl index 5a0d45f..df51dc2 100644 --- a/tests/test_structural.ttl +++ b/tests/test_structural.ttl @@ -4,14 +4,14 @@ @prefix xml: . @prefix xsd: . @prefix rdfs: . -@prefix prov: . +@prefix dc: . @prefix vocab: . @base . rdf:type owl:Ontology ; owl:imports vocab: ; rdfs:comment "Reasoning result set of and "@en ; - prov:wasDerivedFrom + dc:source , . ################################################################# diff --git a/tests/test_validate_output.ttl b/tests/test_validate_output.ttl index 9a788ab..e2fb07a 100644 --- a/tests/test_validate_output.ttl +++ b/tests/test_validate_output.ttl @@ -1,13 +1,13 @@ @prefix dcterms: . @prefix owl: . -@prefix prov: . +@prefix dc: . @prefix rdfs: . @prefix xsd: . a owl:Ontology ; rdfs:comment "Ontology validation of "@en ; - prov:wasDerivedFrom . + dc:source . a owl:NamedIndividual, . diff --git a/tests/test_whelk.ttl b/tests/test_whelk.ttl index c304641..4341388 100644 --- a/tests/test_whelk.ttl +++ b/tests/test_whelk.ttl @@ -4,14 +4,14 @@ @prefix xml: . @prefix xsd: . @prefix rdfs: . -@prefix prov: . +@prefix dc: . @prefix vocab: . @base . rdf:type owl:Ontology ; owl:imports vocab: ; rdfs:comment "Reasoning result set of and "@en ; - prov:wasDerivedFrom + dc:source , . #################################################################