-
Notifications
You must be signed in to change notification settings - Fork 14
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
Updating queries #19
base: master
Are you sure you want to change the base?
Updating queries #19
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix prov: <http://www.w3.org/ns/prov#> | ||
prefix ndar: <https://ndar.nih.gov/api/datadictionary/v2/dataelement/> | ||
prefix nidm: <http://purl.org/nidash/nidm#> | ||
prefix fs: <https://surfer.nmr.mgh.harvard.edu/> | ||
prefix dct: <http://purl.org/dc/terms/> | ||
prefix dctypes: <http://purl.org/dc/dcmitype/> | ||
prefix ilx: <http://uri.interlex.org/> | ||
|
||
select distinct ?ID ?Sex ?Age | ||
where { | ||
|
||
?tool_act a prov:Activity ; | ||
prov:qualifiedAssociation [prov:agent [ndar:src_subject_id ?ID]] . | ||
?as_activity prov:qualifiedAssociation [prov:agent ?agent] ; | ||
dct:isPartOf/dct:isPartOf [dctypes:title ?study] . | ||
?agent ndar:src_subject_id ?ID . | ||
|
||
# find sex data element uuid | ||
{?sex_measure a nidm:PersonalDataElement ; | ||
nidm:isAbout <http://uri.interlex.org/base/ilx_0101292> . #Biological sex | ||
#nidm:isAbout <http://id.nlm.nih.gov/mesh/2018/M0446358> . #Genetic sex | ||
} | ||
|
||
# find age data element uuid | ||
{?age_measure a nidm:PersonalDataElement ; | ||
nidm:isAbout ilx:ilx_0100400 . | ||
} | ||
|
||
?as_entity prov:wasGeneratedBy ?as_activity ; | ||
?sex_measure ?SexCoded ; | ||
?age_measure ?Age. | ||
bind(IF((?SexCoded ="M" || ?SexCoded ="Male"^^xsd:string), "Male"^^xsd:string,"Female"^^xsd:string) as ?Sex) . | ||
#filter (?Sex = "Male"^^xsd:string) . | ||
} | ||
ORDER BY ?ID |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
## The main issue was that the measures (for left, right, and mean) were coming from different stats collections | ||
## (nidm:FSStatsCollection) associated with different activitities (prov:Acitivity). The previous code | ||
## was assuming that the measurements were coming from the same collection and activity. I also fixed other | ||
## minor issues for effeciency (e.g., removing unnecessary transitive subclass searches) and made the code | ||
## simpler to follow. - Fahim | ||
|
||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix prov: <http://www.w3.org/ns/prov#> | ||
prefix ndar: <https://ndar.nih.gov/api/datadictionary/v2/dataelement/> | ||
prefix nidm: <http://purl.org/nidash/nidm#> | ||
prefix fs: <https://surfer.nmr.mgh.harvard.edu/> | ||
prefix dct: <http://purl.org/dc/terms/> | ||
prefix dctypes: <http://purl.org/dc/dcmitype/> | ||
prefix ilx: <http://uri.interlex.org/> | ||
|
||
SELECT DISTINCT | ||
?ID ?Sex ?Age | ||
?measure_left_label ?measure_left_value | ||
?measure_right_label ?measure_right_value | ||
?measure_mean_label ?measure_mean_value | ||
|
||
WHERE | ||
{ | ||
# Gather the activity types for each type of measure associated with a given subject | ||
?measure_left_activity prov:qualifiedAssociation [prov:agent [ndar:src_subject_id ?ID]] . | ||
?measure_right_activity prov:qualifiedAssociation [prov:agent [ndar:src_subject_id ?ID]] . | ||
?measure_mean_activity prov:qualifiedAssociation [prov:agent [ndar:src_subject_id ?ID]] . | ||
|
||
# Gather the stats collections (nidm:FSStatsCollection) generated by each acitivity type above, | ||
# and allocate the variables for measurement types and values to be identified. | ||
?left_stats_collection a nidm:FSStatsCollection; | ||
prov:wasGeneratedBy ?measure_left_activity; | ||
?measure_left ?measure_left_value. | ||
|
||
?right_stats_collection a nidm:FSStatsCollection; | ||
prov:wasGeneratedBy ?measure_right_activity; | ||
?measure_right ?measure_right_value. | ||
|
||
?left_stats_collection a nidm:FSStatsCollection; | ||
prov:wasGeneratedBy ?measure_mean_activity; | ||
?measure_mean ?measure_mean_value. | ||
|
||
# Set the mesurement type identified based on the specific values for each data element | ||
?measure_left a fs:DataElement; | ||
rdfs:label ?measure_left_label; | ||
fs:measure 'ThickAvg' ; | ||
fs:structure 'superiortemporal' ; | ||
nidm:hasLaterality 'Left'. | ||
|
||
?measure_right a fs:DataElement; | ||
rdfs:label ?measure_right_label; | ||
fs:measure 'ThickAvg' ; | ||
fs:structure 'superiortemporal' ; | ||
nidm:hasLaterality 'Right'. | ||
|
||
?measure_mean a fs:DataElement ; | ||
rdfs:label ?measure_mean_label; | ||
fs:measure 'MeanThickness' ; | ||
fs:structure 'Cortex' . | ||
|
||
|
||
?as_activity prov:qualifiedAssociation [prov:agent [ndar:src_subject_id ?ID]] . | ||
|
||
# find sex data element uuid | ||
{?sex_measure a nidm:PersonalDataElement ; | ||
nidm:isAbout <http://uri.interlex.org/base/ilx_0101292> . #Biological sex | ||
#nidm:isAbout <http://id.nlm.nih.gov/mesh/2018/M0446358> . #Genetic sex | ||
} | ||
|
||
# find age data element uuid | ||
{?age_measure a nidm:PersonalDataElement ; | ||
nidm:isAbout ilx:ilx_0100400 . | ||
} | ||
|
||
?as_entity prov:wasGeneratedBy ?as_activity ; | ||
?sex_measure ?SexCoded ; | ||
?age_measure ?Age. | ||
bind(IF((?SexCoded ="M" || ?SexCoded ="Male"^^xsd:string), "Male"^^xsd:string,"Female"^^xsd:string) as ?Sex) . | ||
} | ||
ORDER BY ?ID |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
prefix xsd: <http://www.w3.org/2001/XMLSchema#> | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix prov: <http://www.w3.org/ns/prov#> | ||
prefix ndar: <https://ndar.nih.gov/api/datadictionary/v2/dataelement/> | ||
prefix nidm: <http://purl.org/nidash/nidm#> | ||
prefix fs: <https://surfer.nmr.mgh.harvard.edu/> | ||
prefix dct: <http://purl.org/dc/terms/> | ||
prefix dctypes: <http://purl.org/dc/dcmitype/> | ||
prefix ilx: <http://uri.interlex.org/> | ||
|
||
select distinct ?ID ?Sex ?Age ?left_hipp_vol_softwareLabel ?left_hipp_vol | ||
?right_hipp_vol_softwareLabel ?right_hipp_vol ?eICV_softwareLabel ?eICV | ||
where { | ||
# tool initialization | ||
?tool_act a prov:Activity ; | ||
prov:qualifiedAssociation [prov:agent [nidm:NIDM_0000164 ?tool]] . | ||
?tool_act prov:qualifiedAssociation [prov:agent [ndar:src_subject_id ?ID]] . | ||
|
||
# Left Hippocampus Volume | ||
?tool_entity prov:wasGeneratedBy ?tool_act ; | ||
?measure_left_hipp_vol ?left_hipp_vol . | ||
?measure_left_hipp_vol a/rdfs:subClassOf* nidm:DataElement ; | ||
rdfs:label ?left_hipp_vol_softwareLabel; | ||
fs:measure 'Volume_mm3'; | ||
fs:structure 'Left-Hippocampus'. | ||
# Right Hippocampus Volume | ||
?tool_entity prov:wasGeneratedBy ?tool_act ; | ||
?measure_right_hipp_vol ?right_hipp_vol . | ||
?measure_right_hipp_vol a/rdfs:subClassOf* nidm:DataElement ; | ||
rdfs:label ?right_hipp_vol_softwareLabel; | ||
fs:measure 'Volume_mm3'; | ||
fs:structure 'Right-Hippocampus'. | ||
# estimated Intracarnial Volume | ||
?tool_entity prov:wasGeneratedBy ?tool_act ; | ||
?measure_eICV ?eICV . | ||
?measure_eICV a/rdfs:subClassOf* nidm:DataElement ; | ||
rdfs:label ?eICV_softwareLabel; | ||
fs:measure 'eTIV'; | ||
fs:structure 'EstimatedTotalIntraCranialVol'. | ||
?as_activity prov:qualifiedAssociation [prov:agent [ndar:src_subject_id ?ID]] . | ||
|
||
# find sex data element uuid | ||
{?sex_measure a nidm:PersonalDataElement ; | ||
nidm:isAbout <http://uri.interlex.org/base/ilx_0101292> . #Biological sex | ||
#nidm:isAbout <http://id.nlm.nih.gov/mesh/2018/M0446358> . #Genetic sex | ||
} | ||
|
||
# find age data element uuid | ||
{?age_measure a nidm:PersonalDataElement ; | ||
nidm:isAbout ilx:ilx_0100400 . | ||
} | ||
|
||
?as_entity prov:wasGeneratedBy ?as_activity ; | ||
?sex_measure ?SexCoded ; | ||
?age_measure ?Age. | ||
bind(IF((?SexCoded ="M" || ?SexCoded ="Male"^^xsd:string), "Male"^^xsd:string,"Female"^^xsd:string) as ?Sex) . | ||
#filter (?Sex = "Male"^^xsd:string) . | ||
} | ||
|
||
ORDER BY ?ID | ||
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,29 @@ | ||||||
# This query simply returns the brain measurements without dependencies on other | ||||||
# demographics/assessment measures. | ||||||
|
||||||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||||||
prefix prov: <http://www.w3.org/ns/prov#> | ||||||
prefix ndar: <https://ndar.nih.gov/api/datadictionary/v2/dataelement/> | ||||||
prefix nidm: <http://purl.org/nidash/nidm#> | ||||||
prefix dct: <http://purl.org/dc/terms/> | ||||||
prefix dctypes: <http://purl.org/dc/dcmitype/> | ||||||
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||||||
|
||||||
select distinct ?ID ?tool ?softwareLabel ?federatedLabel ?laterality ?volume | ||||||
where { | ||||||
?tool_act a prov:Activity ; | ||||||
prov:qualifiedAssociation [prov:agent [nidm:NIDM_0000164 ?tool]] . | ||||||
?tool_act prov:qualifiedAssociation [prov:agent [ndar:src_subject_id ?ID]] . | ||||||
?tool_entity prov:wasGeneratedBy ?tool_act ; | ||||||
?measure ?volume . | ||||||
|
||||||
?measure a/rdfs:subClassOf* nidm:DataElement ; | ||||||
rdfs:label ?softwareLabel; | ||||||
nidm:measureOf <http://uri.interlex.org/base/ilx_0112559> ; #Volume | ||||||
nidm:datumType <http://uri.interlex.org/base/ilx_0738276> . #Volume | ||||||
#nidm:measureOf <http://uri.interlex.org/base/ilx_0111689> . #Thickness | ||||||
#nidm:measureOf <http://purl.obolibrary.org/obo/PATO_0001323> . #Surface Area | ||||||
OPTIONAL {?measure nidm:isAbout ?federatedLabel }. | ||||||
OPTIONAL {?measure nidm:hasLaterality ?laterality }. | ||||||
} | ||||||
ORDER BY ?ID ?softwareLabel | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it be sufficient to become consistent across runs? may be add more into the mix here, e.g.
Suggested change
? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking of adding a study name to differentiate the output and aid referencing sourced tools/data, is there such a label? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dunno... I just see above that you are selecting only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran it against the ReproLake_dev and it looks a bit cleaner with tools as the second ordering: ORDER BY ?ID ?tool ?softwareLabel There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so let's add those |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,17 @@ | ||
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
prefix prov: <http://www.w3.org/ns/prov#> | ||
prefix ndar: <https://ndar.nih.gov/api/datadictionary/v2/dataelement/> | ||
prefix fsl: <http://purl.org/nidash/fsl#> | ||
prefix nidm: <http://purl.org/nidash/nidm#> | ||
prefix onli: <http://neurolog.unice.fr/ontoneurolog/v3.0/instrument.owl#> | ||
prefix freesurfer: <https://surfer.nmr.mgh.harvard.edu/> | ||
prefix dx: <http://ncitt.ncit.nih.gov/Diagnosis> | ||
prefix ants: <http://stnava.github.io/ANTs/> | ||
prefix dct: <http://purl.org/dc/terms/> | ||
prefix dctypes: <http://purl.org/dc/dcmitype/> | ||
prefix ncicb: <http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#> | ||
prefix ncit: <http://ncitt.ncit.nih.gov/> | ||
|
||
select distinct (count(?as_entity) as ?flowweighted_count) | ||
where { | ||
|
||
|
||
?as_activity prov:qualifiedAssociation [prov:agent ?agent] ; | ||
where { | ||
?as_activity prov:qualifiedAssociation [prov:agent ?agent] ; | ||
dct:isPartOf/dct:isPartOf [dctypes:title ?study] . | ||
?agent ndar:src_subject_id ?ID . | ||
|
||
|
||
?as_entity prov:wasGeneratedBy ?as_activity ; | ||
nidm:hadImageContrastType nidm:FlowWeighted ; | ||
nidm:Task ?task . | ||
nidm:hadImageContrastType nidm:FlowWeighted ; | ||
nidm:Task ?task . | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.