Changes for page 3 Try it yourself!

Last modified by maaike on 2022/07/06 10:08

From version 8.2
edited by maaike
on 2022/07/05 20:33
Change comment: There is no comment for this version
To version 2.4
edited by maaike
on 2022/06/28 10:33
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -3 Try it yourself!
1 +Try it yourself!
Content
... ... @@ -6,7 +6,7 @@
6 6  1. Find datasets that contain NIfTI files
7 7  1. Find the software that can be used to open .smr file formats?
8 8  
9 -[[Log in to your EBRAINS account and try running the examples yourself!>>https://lab.ch.ebrains.eu/hub/user-redirect/lab/tree/shared/Practical%20Guide%20to%20Using%20the%20EBRAINS%20Knowledge%20Graph%20in%20(your)%20Research%20-%20User%20Examples/query.ipynb]]
9 +=== ===
10 10  
11 11  === Example 1 - How many datasets used human subjects? ===
12 12  
... ... @@ -14,84 +14,21 @@
14 14  
15 15  In the filter function, select "Homo Sapiens" under species. This filters the available datasets in the Knowledge Graph for human subjects only.
16 16  
17 -[[[[image:HumanData.png]]>>https://search.kg.ebrains.eu/?facet_type[0]=Dataset&facet_Dataset_speciesFilter[0]=Homo%20sapien&category=Dataset&species[0]=Homo%20sapiens]]
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 18  
19 -[[https:~~/~~/search.kg.ebrains.eu/?facet_type[0]=Dataset&facet_Dataset_speciesFilter[0]=Homo%20sapien&category=Dataset&species[0]=Homo%20sapiens>>https://search.kg.ebrains.eu/?facet_type[0]=Dataset&facet_Dataset_speciesFilter[0]=Homo%20sapien&category=Dataset&species[0]=Homo%20sapiens]]
20 -
21 21  ==== **Query Builder** ====
22 22  
23 -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.
24 -\\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.
25 25  
26 -{{code language="json" layout="LINENUMBERS"}}
27 -{
28 - "@context": {
29 - "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
30 - "query": "https://schema.hbp.eu/myQuery/",
31 - "propertyName": {
32 - "@id": "propertyName",
33 - "@type": "@id"
34 - },
35 - "path": {
36 - "@id": "path",
37 - "@type": "@id"
38 - }
39 - },
40 - "meta": {
41 - "type": "https://openminds.ebrains.eu/core/DatasetVersion",
42 - "responseVocab": "https://schema.hbp.eu/myQuery/"
43 - },
44 - "structure": [
45 - {
46 - "propertyName": "query:id",
47 - "path": "@id"
48 - },
49 - {
50 - "propertyName": "query:studiedSpecimen",
51 - "required": true,
52 - "filter": {
53 - "op": "CONTAINS",
54 - "value": "Homo sapiens"
55 - },
56 - "path": [
57 - {
58 - "@id": "https://openminds.ebrains.eu/vocab/studiedSpecimen",
59 - "typeFilter": [
60 - {
61 - "@id": "https://openminds.ebrains.eu/core/Subject"
62 - },
63 - {
64 - "@id": "https://openminds.ebrains.eu/core/SubjectGroup"
65 - }
66 - ]
67 - },
68 - {
69 - "@id": "https://openminds.ebrains.eu/vocab/species",
70 - "typeFilter": [
71 - {
72 - "@id": "https://openminds.ebrains.eu/controlledTerms/Species"
73 - }
74 - ]
75 - },
76 - "https://openminds.ebrains.eu/vocab/name"
77 - ]
78 - }
79 - ]
80 -}
81 -{{/code}}
82 -
83 83  === Example 2 - Find datasets with male adult subjects ===
84 84  
85 85  ==== **Search UI** ====
86 86  
87 -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. When searching for "male adult" subjects in the search UI, we find datasets that have these keywords in any of the text summarised on the dataset card (it is a 'fuzzy search' : [[https:~~/~~/search.kg.ebrains.eu/?category=Dataset&q=male%20and%20adult>>https://search.kg.ebrains.eu/?category=Dataset&q=male%20and%20adult]]). To ensure we only look for the any specimen (subjects or samples) originating from male adult mice, we need to write a query and extract the metadata programmatically.
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.
88 88  
89 89  ==== **Query Builder** ====
90 90  
91 -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.
92 -
93 -{{code language="json" layout="LINENUMBERS"}}
94 -{
30 +{{code language="python"}}
31 +query = {
95 95   "@context": {
96 96   "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
97 97   "query": "https://schema.hbp.eu/myQuery/",
... ... @@ -183,8 +183,8 @@
183 183  
184 184  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.
185 185  
186 -{{code language="json" layout="LINENUMBERS"}}
187 -{
123 +{{code language="python"}}
124 +query = {
188 188   "@context": {
189 189   "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
190 190   "query": "https://schema.hbp.eu/myQuery/",
... ... @@ -240,8 +240,8 @@
240 240  
241 241  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".
242 242  
243 -{{code language="json" layout="LINENUMBERS"}}
244 -{
180 +{{code language="python"}}
181 +query = {
245 245   "@context": {
246 246   "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
247 247   "query": "https://schema.hbp.eu/myQuery/",
... ... @@ -295,72 +295,4 @@
295 295  }
296 296  {{/code}}
297 297  
298 -=== (% id="cke_bm_3314S" style="display:none" %) (%%)Example 4 - Find the software that can be used to open .smr file formats? ===
299 -
300 -==== **Search UI** ====
301 -
302 -To find software that can open a particular file format like the Spike2 file format (.smr), we can select the category "software" and then filter based on "input format". We select "application/vnd.spike2.sonpy.son" to ensure we only get software for this file format.
303 -
304 -[[[[image:SoftwareSearch.png||alt="Software Search"]]>>https://search.kg.ebrains.eu/?category=Software&inputFormats[0]=application%2Fvnd.spike2.sonpy.so]]
305 -
306 -[[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]]
307 -
308 -
309 -==== **Query Builder** ====
310 -
311 -{{code language="json" layout="LINENUMBERS"}}
312 -{
313 - "@context": {
314 - "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
315 - "query": "https://schema.hbp.eu/myQuery/",
316 - "propertyName": {
317 - "@id": "propertyName",
318 - "@type": "@id"
319 - },
320 - "path": {
321 - "@id": "path",
322 - "@type": "@id"
323 - }
324 - },
325 - "meta": {
326 - "type": "https://openminds.ebrains.eu/core/SoftwareVersion",
327 - "responseVocab": "https://schema.hbp.eu/myQuery/"
328 - },
329 - "structure": [
330 - {
331 - "propertyName": "query:id",
332 - "path": "@id"
333 - },
334 - {
335 - "propertyName": "query:shortName",
336 - "path": "https://openminds.ebrains.eu/vocab/shortName"
337 - },
338 - {
339 - "propertyName": "query:versionIdentifier",
340 - "path": "https://openminds.ebrains.eu/vocab/versionIdentifier"
341 - },
342 - {
343 - "propertyName": "query:inputFormat",
344 - "path": "https://openminds.ebrains.eu/vocab/inputFormat",
345 - "required": true,
346 - "structure": [
347 - {
348 - "propertyName": "query:name",
349 - "path": "https://openminds.ebrains.eu/vocab/name"
350 - },
351 - {
352 - "propertyName": "query:fileExtension",
353 - "path": "https://openminds.ebrains.eu/vocab/fileExtension",
354 - "required": true,
355 - "filter": {
356 - "op": "CONTAINS",
357 - "value": ".smr"
358 - }
359 - }
360 - ]
361 - }
362 - ]
363 -}
364 -{{/code}}
365 -
366 -
235 +
HumanData.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.maaike
Size
... ... @@ -1,1 +1,0 @@
1 -400.8 KB
Content
SoftwareSearch.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.maaike
Size
... ... @@ -1,1 +1,0 @@
1 -203.7 KB
Content