Skip to content

Commit

Permalink
Merge pull request #281 from dbkeator/master
Browse files Browse the repository at this point in the history
added support to Rest query for PersonalDataElements
  • Loading branch information
dbkeator authored Aug 30, 2021
2 parents 9c866c2 + 27a0bc0 commit 572bb5b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions nidm/experiment/Navigate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions nidm/experiment/Query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion nidm/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 572bb5b

Please sign in to comment.