diff --git a/app/api/utility.py b/app/api/utility.py index 795526b..674b1ec 100644 --- a/app/api/utility.py +++ b/app/api/utility.py @@ -233,7 +233,7 @@ def create_query( f""" SELECT DISTINCT ?dataset_uuid ?dataset_name ?dataset_portal_uri ?sub_id ?age ?sex ?diagnosis ?subject_group ?num_matching_phenotypic_sessions ?num_matching_imaging_sessions - ?session_id ?session_type ?assessment ?image_modal ?session_file_path ?pipeline_version ?pipeline_name + ?session_id ?session_type ?assessment ?image_modal ?session_file_path ?pipeline_name ?pipeline_version WHERE {{ ?dataset_uuid a nb:Dataset; nb:hasLabel ?dataset_name; @@ -289,8 +289,8 @@ def create_query( OPTIONAL {{ ?imaging_session nb:hasCompletedPipeline ?pipeline. - ?pipeline nb:hasPipelineVersion ?pipeline_version; - nb:hasPipelineName ?pipeline_name. + ?pipeline nb:hasPipelineName ?pipeline_name; + nb:hasPipelineVersion ?pipeline_version. }} }} {imaging_session_level_filters} diff --git a/docs/default_neurobagel_query.rq b/docs/default_neurobagel_query.rq index 132ca6c..96f4fba 100644 --- a/docs/default_neurobagel_query.rq +++ b/docs/default_neurobagel_query.rq @@ -52,13 +52,18 @@ WHERE { ?subject a nb:Subject. OPTIONAL { ?subject nb:hasSession ?imaging_session. - ?imaging_session a nb:ImagingSession; - nb:hasAcquisition/nb:hasContrastType ?image_modal. - } - OPTIONAL { - ?imaging_session nb:hasCompletedPipeline ?pipeline. - ?pipeline nb:hasPipelineVersion ?pipeline_version. - ?pipeline nb:hasPipelineName ?pipeline_name. + ?imaging_session a nb:ImagingSession. + + OPTIONAL { + ?imaging_session nb:hasAcquisition ?acquisition. + ?acquisition nb:hasContrastType ?image_modal. + } + + OPTIONAL { + ?imaging_session nb:hasCompletedPipeline ?pipeline. + ?pipeline nb:hasPipelineName ?pipeline_name; + nb:hasPipelineVersion ?pipeline_version. + } } } GROUP BY ?subject