Wiki source code of Try it yourself!

Version 2.6 by maaike on 2022/06/28 15:34

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 === ===
10
11 === Example 1 - How many datasets used human subjects? ===
12
13 ==== **Search UI** ====
14
15 In the filter function, select "Homo Sapiens" under species. This filters the available datasets in the Knowledge Graph for human subjects only.
16
17 [[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]]
18
19 ==== **Query Builder** ====
20
21
22 === Example 2 - Find datasets with male adult subjects ===
23
24 ==== **Search UI** ====
25
26 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.
27
28 ==== **Query Builder** ====
29
30 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
31
32 {{code language="python"}}
33 query = {
34 "@context": {
35 "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
36 "query": "https://schema.hbp.eu/myQuery/",
37 "propertyName": {
38 "@id": "propertyName",
39 "@type": "@id"
40 },
41 "path": {
42 "@id": "path",
43 "@type": "@id"
44 }
45 },
46 "meta": {
47 "type": "https://openminds.ebrains.eu/core/DatasetVersion",
48 "responseVocab": "https://schema.hbp.eu/myQuery/"
49 },
50 "structure": [
51 {
52 "propertyName": "query:id",
53 "path": "@id"
54 },
55 {
56 "propertyName": "query:shortName",
57 "path": "https://openminds.ebrains.eu/vocab/shortName"
58 },
59 {
60 "propertyName": "query:studiedSpecimen",
61 "path": "https://openminds.ebrains.eu/vocab/studiedSpecimen",
62 "required": true,
63 "structure": [
64 {
65 "propertyName": "query:id",
66 "path": "@id"
67 },
68 {
69 "propertyName": "query:biologicalSex",
70 "path": "https://openminds.ebrains.eu/vocab/biologicalSex",
71 "required": true,
72 "structure": {
73 "propertyName": "query:name",
74 "path": "https://openminds.ebrains.eu/vocab/name",
75 "required": true,
76 "filter": {
77 "op": "EQUALS",
78 "value": "male"
79 }
80 }
81 },
82 {
83 "propertyName": "query:studiedState",
84 "path": "https://openminds.ebrains.eu/vocab/studiedState",
85 "required": true,
86 "structure": {
87 "propertyName": "query:ageCategory",
88 "path": "https://openminds.ebrains.eu/vocab/ageCategory",
89 "required": true,
90 "structure": {
91 "propertyName": "query:name",
92 "path": "https://openminds.ebrains.eu/vocab/name",
93 "required": true,
94 "filter": {
95 "op": "EQUALS",
96 "value": "adult"
97 }
98 }
99 }
100 }
101 ]
102 }
103 ]
104 }
105 {{/code}}
106
107 === Example 3 - Find datasets that contain NIfTI files ===
108
109 ==== **Search UI** ====
110
111 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.
112
113 [[[[image:ContentTypes.png]]>>https://search.kg.ebrains.eu/?facet_type[0]=Dataset&facet_Dataset_contentTypes[0]=application%2Fvnd.nifti.1]]
114
115 [[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]]
116
117 ==== **Query Builder** ====
118
119 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.
120
121 **Query datasets based on file extension**
122
123 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.
124
125 {{code language="python"}}
126 query = {
127 "@context": {
128 "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
129 "query": "https://schema.hbp.eu/myQuery/",
130 "propertyName": {
131 "@id": "propertyName",
132 "@type": "@id"
133 },
134 "path": {
135 "@id": "path",
136 "@type": "@id"
137 }
138 },
139 "meta": {
140 "type": "https://openminds.ebrains.eu/core/DatasetVersion",
141 "responseVocab": "https://schema.hbp.eu/myQuery/"
142 },
143 "structure": [
144 {
145 "propertyName": "query:shortName",
146 "path": "https://openminds.ebrains.eu/vocab/shortName"
147 },
148 {
149 "propertyName": "query:id",
150 "path": "@id"
151 },
152 {
153 "propertyName": "query:repository",
154 "path": "https://openminds.ebrains.eu/vocab/repository",
155 "required": true,
156 "structure": {
157 "propertyName": "query:fileRepository",
158 "path": {
159 "@id": "https://openminds.ebrains.eu/vocab/fileRepository",
160 "reverse": true
161 },
162 "required": true,
163 "structure": {
164 "propertyName": "query:name",
165 "path": "https://openminds.ebrains.eu/vocab/name",
166 "required": true,
167 "filter": {
168 "op": "ENDS_WITH",
169 "value": ".nii.gz"
170 }
171 }
172 }
173 }
174 ]
175 }
176 {{/code}}
177
178 **Query datasets based on content type**
179
180 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".
181
182 {{code language="python"}}
183 query = {
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:contentTypePattern",
215 "path": "https://openminds.ebrains.eu/vocab/contentTypePattern",
216 "required": true,
217 "structure": {
218 "propertyName": "query:contentType",
219 "path": "https://openminds.ebrains.eu/vocab/contentType",
220 "required": true,
221 "structure": {
222 "propertyName": "query:name",
223 "path": "https://openminds.ebrains.eu/vocab/name",
224 "required": true,
225 "filter": {
226 "op": "CONTAINS",
227 "value": "nifti"
228 }
229 }
230 }
231 }
232 }
233 ]
234 }
235 {{/code}}
236
237