Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support to Rest query for PersonalDataElements #281

Merged
merged 1 commit into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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