Wiki source code of Try it yourself!

Version 2.8 by maaike on 2022/06/28 16:15

Show last authors
1 == User examples ==
2
3
4 1. How many datasets used human subjects?
5 1. Find datasets with male adult subjects
6 1. Find datasets that contain NIfTI files
7 1. Find the software that can be used to open .smr file formats?
8
9 === Example 1 - How many datasets used human subjects? ===
10
11 ==== **Search UI** ====
12
13 In the filter function, select "Homo Sapiens" under species. This filters the available datasets in the Knowledge Graph for human subjects only.
14
15 [[https:~~/~~/search.kg.ebrains.eu/?facet_type[0]=Dataset&facet_Dataset_speciesFilter[0]=Homo%20sapiens>>https://search.kg.ebrains.eu/?facet_type[0]=Dataset&facet_Dataset_speciesFilter[0]=Homo%20sapiens]]
16
17 ==== **Query Builder** ====
18
19
20 === Example 2 - Find datasets with male adult subjects ===
21
22 ==== **Search UI** ====
23
24 All the metadata in the knowledge graph is represented by nodes and their relationships by the edges. Most of the "basic" metadata is visualised in the Search UI to make it easy for the user to find datasets that fit certain criteria without needing to know how to navigate and traverse a graph structure.
25
26 ==== **Query Builder** ====
27
28 For dataset versions that use male adult subjects, we can filter datasets using these 2 properties. The easiest way is to add a required filter to biological sex that is "EQUAL" to "male" and the age category "EQUAL" to "adult". By selecting the filter "EQUAL" instead of "CONTAINS", we ensure that only datasets with adult animals are found. If we want to be more general and include all subjects from the onset of sexual maturity, we can use "CONTAINS" instead as this will include subjects with the age category "prime adult", "young adult" and "late adult" as well.
29
30 {{code language="python"}}
31 query = {
32 "@context": {
33 "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
34 "query": "https://schema.hbp.eu/myQuery/",
35 "propertyName": {
36 "@id": "propertyName",
37 "@type": "@id"
38 },
39 "path": {
40 "@id": "path",
41 "@type": "@id"
42 }
43 },
44 "meta": {
45 "type": "https://openminds.ebrains.eu/core/DatasetVersion",
46 "responseVocab": "https://schema.hbp.eu/myQuery/"
47 },
48 "structure": [
49 {
50 "propertyName": "query:id",
51 "path": "@id"
52 },
53 {
54 "propertyName": "query:shortName",
55 "path": "https://openminds.ebrains.eu/vocab/shortName"
56 },
57 {
58 "propertyName": "query:studiedSpecimen",
59 "path": "https://openminds.ebrains.eu/vocab/studiedSpecimen",
60 "required": true,
61 "structure": [
62 {
63 "propertyName": "query:id",
64 "path": "@id"
65 },
66 {
67 "propertyName": "query:biologicalSex",
68 "path": "https://openminds.ebrains.eu/vocab/biologicalSex",
69 "required": true,
70 "structure": {
71 "propertyName": "query:name",
72 "path": "https://openminds.ebrains.eu/vocab/name",
73 "required": true,
74 "filter": {
75 "op": "EQUALS",
76 "value": "male"
77 }
78 }
79 },
80 {
81 "propertyName": "query:studiedState",
82 "path": "https://openminds.ebrains.eu/vocab/studiedState",
83 "required": true,
84 "structure": {
85 "propertyName": "query:ageCategory",
86 "path": "https://openminds.ebrains.eu/vocab/ageCategory",
87 "required": true,
88 "structure": {
89 "propertyName": "query:name",
90 "path": "https://openminds.ebrains.eu/vocab/name",
91 "required": true,
92 "filter": {
93 "op": "EQUALS",
94 "value": "adult"
95 }
96 }
97 }
98 }
99 ]
100 }
101 ]
102 }
103 {{/code}}
104
105 === Example 3 - Find datasets that contain NIfTI files ===
106
107 ==== **Search UI** ====
108
109 Files are organised based on their file format (i.e. file extension) and the software that could be used to open these files. In openMINDS this is captured with the content type. In the filter function, select "application/vnd.nifti.1" under content types to select all the dataset with a NIfTI 1 file format.
110
111 [[[[image:ContentTypes.png]]>>https://search.kg.ebrains.eu/?facet_type[0]=Dataset&facet_Dataset_contentTypes[0]=application%2Fvnd.nifti.1]]
112
113 [[https:~~/~~/search.kg.ebrains.eu/?facet_type[0]=Dataset&facet_Dataset_contentTypes[0]=application%2Fvnd.nifti.1>>https://search.kg.ebrains.eu/?facet_type[0]=Dataset&facet_Dataset_contentTypes[0]=application%2Fvnd.nifti.1]]
114
115 ==== **Query Builder** ====
116
117 To find datasets with a particular file format in it, we can either write a query for 1) the file extension or 2) based on the content type. The difference between the two approaches is that the first approach just looks at the file extension without considering the what type of file format it is and what software can be used to open it. For example, both nifti 1 and nifti 2 files have the same extension. The nifti 2 format is an update of nifti 1 and will not be recognised as a valid nifti 1 format. This is important when considering what program to use when opening the files. To be able to differentiate, we describe the files with content types that tell the user what type of file format it is and we have linked a number of software applications to that content type to facilitate reuse of the data.
118
119 **Query datasets based on file extension**
120
121 We can restrict the search results with a filter using a required field. In this particular case a filter that "ENDS_WITH" a value (e.g. .nii.gz) could be used. We can use .nii for normal nifti files or .nii.gz for compressed nifty files.
122
123 {{code language="python"}}
124 query = {
125 "@context": {
126 "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
127 "query": "https://schema.hbp.eu/myQuery/",
128 "propertyName": {
129 "@id": "propertyName",
130 "@type": "@id"
131 },
132 "path": {
133 "@id": "path",
134 "@type": "@id"
135 }
136 },
137 "meta": {
138 "type": "https://openminds.ebrains.eu/core/DatasetVersion",
139 "responseVocab": "https://schema.hbp.eu/myQuery/"
140 },
141 "structure": [
142 {
143 "propertyName": "query:shortName",
144 "path": "https://openminds.ebrains.eu/vocab/shortName"
145 },
146 {
147 "propertyName": "query:id",
148 "path": "@id"
149 },
150 {
151 "propertyName": "query:repository",
152 "path": "https://openminds.ebrains.eu/vocab/repository",
153 "required": true,
154 "structure": {
155 "propertyName": "query:fileRepository",
156 "path": {
157 "@id": "https://openminds.ebrains.eu/vocab/fileRepository",
158 "reverse": true
159 },
160 "required": true,
161 "structure": {
162 "propertyName": "query:name",
163 "path": "https://openminds.ebrains.eu/vocab/name",
164 "required": true,
165 "filter": {
166 "op": "ENDS_WITH",
167 "value": ".nii.gz"
168 }
169 }
170 }
171 }
172 ]
173 }
174 {{/code}}
175
176 **Query datasets based on content type**
177
178 To find datasets using the content type structure, we can use a filter that "CONTAINS" a value (e.g. nifti). We are now not distinguishing between nifti 1 or nifti 2 files, but select all files that are classified as "nifti". If you want to narrow down the results further, you could replace "nifti" by "nifti.1" or "nifti.2".
179
180 {{code language="python"}}
181 query = {
182 "@context": {
183 "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
184 "query": "https://schema.hbp.eu/myQuery/",
185 "propertyName": {
186 "@id": "propertyName",
187 "@type": "@id"
188 },
189 "path": {
190 "@id": "path",
191 "@type": "@id"
192 }
193 },
194 "meta": {
195 "type": "https://openminds.ebrains.eu/core/DatasetVersion",
196 "responseVocab": "https://schema.hbp.eu/myQuery/"
197 },
198 "structure": [
199 {
200 "propertyName": "query:shortName",
201 "path": "https://openminds.ebrains.eu/vocab/shortName"
202 },
203 {
204 "propertyName": "query:id",
205 "path": "@id"
206 },
207 {
208 "propertyName": "query:repository",
209 "path": "https://openminds.ebrains.eu/vocab/repository",
210 "required": true,
211 "structure": {
212 "propertyName": "query:contentTypePattern",
213 "path": "https://openminds.ebrains.eu/vocab/contentTypePattern",
214 "required": true,
215 "structure": {
216 "propertyName": "query:contentType",
217 "path": "https://openminds.ebrains.eu/vocab/contentType",
218 "required": true,
219 "structure": {
220 "propertyName": "query:name",
221 "path": "https://openminds.ebrains.eu/vocab/name",
222 "required": true,
223 "filter": {
224 "op": "CONTAINS",
225 "value": "nifti"
226 }
227 }
228 }
229 }
230 }
231 ]
232 }
233 {{/code}}
234
235