Wiki source code of 3 Try it yourself!

Version 5.1 by oschmid on 2022/07/05 14:58

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 To search for datasets containing human subjects only, you can first declare the id (to get the involved instances) as well as a link to the "studied specimen" (you can add a type filter and restrict it to "Subject" and "Subject group" only since we are not interested in "Tissue samples" and "Tissue sample collections" in this moment). From "studied specimen", we're interested in the "Species" (here you can - again add a type filter to exclude "Strain" since this is irrelevant for human subjects). For the "Species", we want the "label" to contain "homo sapiens" which is why we add a filter "contains" with the value "homo sapiens".  We might want to simplify the deeply nested structure by "flattening" both, the "Studied specimen" as well as the "Species". Once we go to the "execute query" section (the play button on the left) and we run the query, we can see the total number of dataset versions.
20 \\Please note that this number can differ from the one you figured out in the search UI. The reason for this is, that the search UI does only count the newest dataset version whilst the query also returns older dataset versions.
21
22 {{code language="json" layout="LINENUMBERS"}}
23 {
24 "@context": {
25 "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
26 "query": "https://schema.hbp.eu/myQuery/",
27 "propertyName": {
28 "@id": "propertyName",
29 "@type": "@id"
30 },
31 "path": {
32 "@id": "path",
33 "@type": "@id"
34 }
35 },
36 "meta": {
37 "type": "https://openminds.ebrains.eu/core/DatasetVersion",
38 "responseVocab": "https://schema.hbp.eu/myQuery/"
39 },
40 "structure": [
41 {
42 "propertyName": "query:id",
43 "path": "@id"
44 },
45 {
46 "propertyName": "query:studiedSpecimen",
47 "required": true,
48 "filter": {
49 "op": "CONTAINS",
50 "value": "Homo sapiens"
51 },
52 "path": [
53 {
54 "@id": "https://openminds.ebrains.eu/vocab/studiedSpecimen",
55 "typeFilter": [
56 {
57 "@id": "https://openminds.ebrains.eu/core/Subject"
58 },
59 {
60 "@id": "https://openminds.ebrains.eu/core/SubjectGroup"
61 }
62 ]
63 },
64 {
65 "@id": "https://openminds.ebrains.eu/vocab/species",
66 "typeFilter": [
67 {
68 "@id": "https://openminds.ebrains.eu/controlledTerms/Species"
69 }
70 ]
71 },
72 "https://openminds.ebrains.eu/vocab/name"
73 ]
74 }
75 ]
76 }
77 {{/code}}
78
79 === Example 2 - Find datasets with male adult subjects ===
80
81 ==== **Search UI** ====
82
83 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.
84
85 ==== **Query Builder** ====
86
87 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.
88
89 {{code language="json" layout="LINENUMBERS"}}
90 {
91 "@context": {
92 "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
93 "query": "https://schema.hbp.eu/myQuery/",
94 "propertyName": {
95 "@id": "propertyName",
96 "@type": "@id"
97 },
98 "path": {
99 "@id": "path",
100 "@type": "@id"
101 }
102 },
103 "meta": {
104 "type": "https://openminds.ebrains.eu/core/DatasetVersion",
105 "responseVocab": "https://schema.hbp.eu/myQuery/"
106 },
107 "structure": [
108 {
109 "propertyName": "query:id",
110 "path": "@id"
111 },
112 {
113 "propertyName": "query:shortName",
114 "path": "https://openminds.ebrains.eu/vocab/shortName"
115 },
116 {
117 "propertyName": "query:studiedSpecimen",
118 "path": "https://openminds.ebrains.eu/vocab/studiedSpecimen",
119 "required": true,
120 "structure": [
121 {
122 "propertyName": "query:id",
123 "path": "@id"
124 },
125 {
126 "propertyName": "query:biologicalSex",
127 "path": "https://openminds.ebrains.eu/vocab/biologicalSex",
128 "required": true,
129 "structure": {
130 "propertyName": "query:name",
131 "path": "https://openminds.ebrains.eu/vocab/name",
132 "required": true,
133 "filter": {
134 "op": "EQUALS",
135 "value": "male"
136 }
137 }
138 },
139 {
140 "propertyName": "query:studiedState",
141 "path": "https://openminds.ebrains.eu/vocab/studiedState",
142 "required": true,
143 "structure": {
144 "propertyName": "query:ageCategory",
145 "path": "https://openminds.ebrains.eu/vocab/ageCategory",
146 "required": true,
147 "structure": {
148 "propertyName": "query:name",
149 "path": "https://openminds.ebrains.eu/vocab/name",
150 "required": true,
151 "filter": {
152 "op": "EQUALS",
153 "value": "adult"
154 }
155 }
156 }
157 }
158 ]
159 }
160 ]
161 }
162 {{/code}}
163
164 === Example 3 - Find datasets that contain NIfTI files ===
165
166 ==== **Search UI** ====
167
168 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.
169
170 [[[[image:ContentTypes.png]]>>https://search.kg.ebrains.eu/?facet_type[0]=Dataset&facet_Dataset_contentTypes[0]=application%2Fvnd.nifti.1]]
171
172 [[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]]
173
174 ==== **Query Builder** ====
175
176 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.
177
178 **Query datasets based on file extension**
179
180 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.
181
182 {{code language="json" layout="LINENUMBERS"}}
183 {
184 "@context": {
185 "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
186 "query": "https://schema.hbp.eu/myQuery/",
187 "propertyName": {
188 "@id": "propertyName",
189 "@type": "@id"
190 },
191 "path": {
192 "@id": "path",
193 "@type": "@id"
194 }
195 },
196 "meta": {
197 "type": "https://openminds.ebrains.eu/core/DatasetVersion",
198 "responseVocab": "https://schema.hbp.eu/myQuery/"
199 },
200 "structure": [
201 {
202 "propertyName": "query:shortName",
203 "path": "https://openminds.ebrains.eu/vocab/shortName"
204 },
205 {
206 "propertyName": "query:id",
207 "path": "@id"
208 },
209 {
210 "propertyName": "query:repository",
211 "path": "https://openminds.ebrains.eu/vocab/repository",
212 "required": true,
213 "structure": {
214 "propertyName": "query:fileRepository",
215 "path": {
216 "@id": "https://openminds.ebrains.eu/vocab/fileRepository",
217 "reverse": true
218 },
219 "required": true,
220 "structure": {
221 "propertyName": "query:name",
222 "path": "https://openminds.ebrains.eu/vocab/name",
223 "required": true,
224 "filter": {
225 "op": "ENDS_WITH",
226 "value": ".nii.gz"
227 }
228 }
229 }
230 }
231 ]
232 }
233 {{/code}}
234
235 **Query datasets based on content type**
236
237 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".
238
239 {{code language="json" layout="LINENUMBERS"}}
240 {
241 "@context": {
242 "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
243 "query": "https://schema.hbp.eu/myQuery/",
244 "propertyName": {
245 "@id": "propertyName",
246 "@type": "@id"
247 },
248 "path": {
249 "@id": "path",
250 "@type": "@id"
251 }
252 },
253 "meta": {
254 "type": "https://openminds.ebrains.eu/core/DatasetVersion",
255 "responseVocab": "https://schema.hbp.eu/myQuery/"
256 },
257 "structure": [
258 {
259 "propertyName": "query:shortName",
260 "path": "https://openminds.ebrains.eu/vocab/shortName"
261 },
262 {
263 "propertyName": "query:id",
264 "path": "@id"
265 },
266 {
267 "propertyName": "query:repository",
268 "path": "https://openminds.ebrains.eu/vocab/repository",
269 "required": true,
270 "structure": {
271 "propertyName": "query:contentTypePattern",
272 "path": "https://openminds.ebrains.eu/vocab/contentTypePattern",
273 "required": true,
274 "structure": {
275 "propertyName": "query:contentType",
276 "path": "https://openminds.ebrains.eu/vocab/contentType",
277 "required": true,
278 "structure": {
279 "propertyName": "query:name",
280 "path": "https://openminds.ebrains.eu/vocab/name",
281 "required": true,
282 "filter": {
283 "op": "CONTAINS",
284 "value": "nifti"
285 }
286 }
287 }
288 }
289 }
290 ]
291 }
292 {{/code}}
293
294 === (% id="cke_bm_3314S" style="display:none" %) (%%)Example 4 - Find the software that can be used to open .smr file formats? ===
295
296 ==== **Search UI** ====
297
298
299 [[https:~~/~~/search.kg.ebrains.eu/?category=Software&inputFormats[0]=application%2Fvnd.spike2.sonpy.son>>https://search.kg.ebrains.eu/?category=Software&inputFormats[0]=application%2Fvnd.spike2.sonpy.son]]
300
301
302 ==== **Query Builder** ====
303
304 {{code language="json" layout="LINENUMBERS"}}
305 {
306 "@context": {
307 "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
308 "query": "https://schema.hbp.eu/myQuery/",
309 "propertyName": {
310 "@id": "propertyName",
311 "@type": "@id"
312 },
313 "path": {
314 "@id": "path",
315 "@type": "@id"
316 }
317 },
318 "meta": {
319 "type": "https://openminds.ebrains.eu/core/SoftwareVersion",
320 "responseVocab": "https://schema.hbp.eu/myQuery/"
321 },
322 "structure": [
323 {
324 "propertyName": "query:id",
325 "path": "@id"
326 },
327 {
328 "propertyName": "query:shortName",
329 "path": "https://openminds.ebrains.eu/vocab/shortName"
330 },
331 {
332 "propertyName": "query:versionIdentifier",
333 "path": "https://openminds.ebrains.eu/vocab/versionIdentifier"
334 },
335 {
336 "propertyName": "query:inputFormat",
337 "path": "https://openminds.ebrains.eu/vocab/inputFormat",
338 "required": true,
339 "structure": [
340 {
341 "propertyName": "query:name",
342 "path": "https://openminds.ebrains.eu/vocab/name"
343 },
344 {
345 "propertyName": "query:fileExtension",
346 "path": "https://openminds.ebrains.eu/vocab/fileExtension",
347 "required": true,
348 "filter": {
349 "op": "CONTAINS",
350 "value": ".smr"
351 }
352 }
353 ]
354 }
355 ]
356 }
357 {{/code}}
358
359
360