From 27a0bc065865e4361e94a0014cb3ffeb851f1917 Mon Sep 17 00:00:00 2001 From: David Keator Date: Mon, 30 Aug 2021 13:53:59 -0700 Subject: [PATCH] added support to Rest query for PersonalDataElements --- nidm/experiment/Navigate.py | 8 ++++++++ nidm/experiment/Query.py | 3 +++ nidm/version.py | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/nidm/experiment/Navigate.py b/nidm/experiment/Navigate.py index 7fb9a597..3b655fd8 100644 --- a/nidm/experiment/Navigate.py +++ b/nidm/experiment/Navigate.py @@ -334,6 +334,14 @@ def GetDataelements(nidm_files_tuple): result['data_elements']['label'].append(str(dti['label'])) result['data_elements']['data_type_info'].append( dti ) found_uris.add(de_uri) + # find all the datatypes + for de_uri in rdf_graph.subjects(predicate=isa, object=Constants.NIDM['PersonalDataElement']): + if de_uri not in found_uris: # don't add duplicates + dti = getDataTypeInfo(rdf_graph, de_uri) + result['data_elements']['uuid'].append(str(dti['dataElementURI'])) + result['data_elements']['label'].append(str(dti['label'])) + result['data_elements']['data_type_info'].append(dti) + found_uris.add(de_uri) # now look for any of the CDEs all_predicates = GetAllPredicates(nidm_files_tuple) diff --git a/nidm/experiment/Query.py b/nidm/experiment/Query.py index 9c5dda50..9d421186 100644 --- a/nidm/experiment/Query.py +++ b/nidm/experiment/Query.py @@ -1117,6 +1117,9 @@ def getDataTypeInfo(source_graph, datatype): # check to see if the datatype is in the main graph. If not, look in the CDE graph if source_graph and (expanded_datatype, isa, Constants.NIDM['DataElement']) in source_graph: rdf_graph = source_graph + # check if datatype is a personal data element + elif source_graph and (expanded_datatype, isa, Constants.NIDM['PersonalDataElement']) in source_graph: + rdf_graph = source_graph else: rdf_graph = nidm.experiment.CDE.getCDEs() diff --git a/nidm/version.py b/nidm/version.py index 2eb50fe6..0f89f5ca 100644 --- a/nidm/version.py +++ b/nidm/version.py @@ -4,7 +4,7 @@ # Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z" _version_major = 3 _version_minor = 8 -_version_micro = '3' # use '' for first of series, number for 1 and above +_version_micro = '4' # use '' for first of series, number for 1 and above _version_extra = '' # _version_extra = '' # Uncomment this for full releases