From 2f9adbc5cf45b61e8ded5a66df68c97a61dad41b Mon Sep 17 00:00:00 2001 From: cmaumet Date: Mon, 4 Sep 2023 11:30:39 +0200 Subject: [PATCH] more fixes in compliance with updated context --- bids_prov/afni/afni_parser.py | 2 +- bids_prov/fsl/fsl_parser.py | 2 +- bids_prov/spm/spm_parser.py | 4 ++-- bids_prov/tests/samples_test/batch_example_spm.jsonld | 2 +- bids_prov/tests/samples_test/batch_example_spm_ref.jsonld | 2 +- bids_prov/tests/samples_test/partial_conjunction.jsonld | 2 +- bids_prov/tests/samples_test/partial_conjunction_ref.jsonld | 2 +- bids_prov/utils.py | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bids_prov/afni/afni_parser.py b/bids_prov/afni/afni_parser.py index 552541a14..021ba667b 100644 --- a/bids_prov/afni/afni_parser.py +++ b/bids_prov/afni/afni_parser.py @@ -220,7 +220,7 @@ def build_records(commands_bloc: list, agent_id: str, verbose: bool = False): activity["Used"].append(existing_input["@id"]) for output_path in outputs: - records["prov:Entity"].append( + records["Entities"].append( { "@id": f"urn:{get_id()}", "Label": os.path.split(output_path)[1], diff --git a/bids_prov/fsl/fsl_parser.py b/bids_prov/fsl/fsl_parser.py index 605920d7b..3bcb3e458 100644 --- a/bids_prov/fsl/fsl_parser.py +++ b/bids_prov/fsl/fsl_parser.py @@ -528,7 +528,7 @@ def fsl_to_bids_prov(filename: str, context_url=CONTEXT_URL, output_file=None, records = build_records(lines, agent_id) graph["Records"].update(records) - compute_sha_256_entity(graph["Records"]["prov:Entity"]) + compute_sha_256_entity(graph["Records"]["Entities"]) return writing_jsonld(graph, indent, output_file) diff --git a/bids_prov/spm/spm_parser.py b/bids_prov/spm/spm_parser.py index 931c2c259..6258cf135 100644 --- a/bids_prov/spm/spm_parser.py +++ b/bids_prov/spm/spm_parser.py @@ -227,7 +227,7 @@ def find_output_id_from_closest(closest_activity: dict, records: dict) -> str: else: output_id = "urn:" + get_id() # output_id = next( - # (entity["@id"] for entity in records["prov:Entity"] + # (entity["@id"] for entity in records["Entities"] # if parts[-1] == entity["Label"] and entity["GeneratedBy"] == closest_activity["@id"] # ), "urn:" + get_id() # ) # find entity id generated by closest activity, if None new get_id @@ -293,7 +293,7 @@ def get_records(task_groups: dict, agent_id: str, verbose=False) -> dict: Returns ------- dict[str, list] - records : dict with key "@context", ... "Records":{"prov:Agent": ..."prov:Activity":..."prov:Entity":....} + records : dict with key "@context", ... "Records":{"prov:Agent": ..."prov:Activity":..."Entities":....} """ diff --git a/bids_prov/tests/samples_test/batch_example_spm.jsonld b/bids_prov/tests/samples_test/batch_example_spm.jsonld index bcd72cd0b..3f1d68c71 100644 --- a/bids_prov/tests/samples_test/batch_example_spm.jsonld +++ b/bids_prov/tests/samples_test/batch_example_spm.jsonld @@ -270,7 +270,7 @@ } } ], - "prov:Entity": [ + "Entities": [ { "@id": "urn:4a800646-417a-4105-bc31-99944567ceb1", "Label": "func_sub-01_task-tonecounting_bold.nii.gz", diff --git a/bids_prov/tests/samples_test/batch_example_spm_ref.jsonld b/bids_prov/tests/samples_test/batch_example_spm_ref.jsonld index e31bd2c70..6129d9a41 100644 --- a/bids_prov/tests/samples_test/batch_example_spm_ref.jsonld +++ b/bids_prov/tests/samples_test/batch_example_spm_ref.jsonld @@ -256,7 +256,7 @@ } } ], - "prov:Entity": [ + "Entities": [ { "@id": "urn:4a800646-417a-4105-bc31-99944567ceb1", "Label": "func_sub-01_task-tonecounting_bold.nii.gz", diff --git a/bids_prov/tests/samples_test/partial_conjunction.jsonld b/bids_prov/tests/samples_test/partial_conjunction.jsonld index de6fda867..ea0058b9b 100644 --- a/bids_prov/tests/samples_test/partial_conjunction.jsonld +++ b/bids_prov/tests/samples_test/partial_conjunction.jsonld @@ -268,7 +268,7 @@ } } ], - "prov:Entity": [ + "Entities": [ { "@id": "urn:4a800646-417a-4105-bc31-99944567ceb1", "Label": "func_sub-01_task-tonecounting_bold.nii.gz", diff --git a/bids_prov/tests/samples_test/partial_conjunction_ref.jsonld b/bids_prov/tests/samples_test/partial_conjunction_ref.jsonld index 02079489f..77462f826 100644 --- a/bids_prov/tests/samples_test/partial_conjunction_ref.jsonld +++ b/bids_prov/tests/samples_test/partial_conjunction_ref.jsonld @@ -254,7 +254,7 @@ } } ], - "prov:Entity": [ + "Entities": [ { "@id": "urn:4a800646-417a-4105-bc31-99944567ceb1", "Label": "func_sub-01_task-tonecounting_bold.nii.gz", diff --git a/bids_prov/utils.py b/bids_prov/utils.py index cb5b5007f..915d8fa00 100644 --- a/bids_prov/utils.py +++ b/bids_prov/utils.py @@ -30,7 +30,7 @@ def get_default_graph(label: str, context_url: str = CONTEXT_URL, soft_ver: str } ], "prov:Activity": [], - "prov:Entity": [], + "Entities": [], }, }, agent_id