Changes for page 3 Try it yourself!

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

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

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -Try it yourself!
1 +3 Try it yourself!
Content
... ... @@ -6,6 +6,8 @@
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]]
10 +
9 9  === Example 1 - How many datasets used human subjects? ===
10 10  
11 11  ==== **Search UI** ====
... ... @@ -12,23 +12,84 @@
12 12  
13 13  In the filter function, select "Homo Sapiens" under species. This filters the available datasets in the Knowledge Graph for human subjects only.
14 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]]
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]]
16 16  
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 +
17 17  ==== **Query Builder** ====
18 18  
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.
19 19  
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 +
20 20  === Example 2 - Find datasets with male adult subjects ===
21 21  
22 22  ==== **Search UI** ====
23 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.
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.
25 25  
26 26  ==== **Query Builder** ====
27 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
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.
29 29  
30 -{{code language="python"}}
31 -query = {
93 +{{code language="json" layout="LINENUMBERS"}}
94 +{
32 32   "@context": {
33 33   "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
34 34   "query": "https://schema.hbp.eu/myQuery/",
... ... @@ -120,8 +120,8 @@
120 120  
121 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 122  
123 -{{code language="python"}}
124 -query = {
186 +{{code language="json" layout="LINENUMBERS"}}
187 +{
125 125   "@context": {
126 126   "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
127 127   "query": "https://schema.hbp.eu/myQuery/",
... ... @@ -177,8 +177,8 @@
177 177  
178 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 179  
180 -{{code language="python"}}
181 -query = {
243 +{{code language="json" layout="LINENUMBERS"}}
244 +{
182 182   "@context": {
183 183   "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
184 184   "query": "https://schema.hbp.eu/myQuery/",
... ... @@ -232,4 +232,72 @@
232 232  }
233 233  {{/code}}
234 234  
235 -
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 +
HumanData.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.maaike
Size
... ... @@ -1,0 +1,1 @@
1 +400.8 KB
Content
SoftwareSearch.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.maaike
Size
... ... @@ -1,0 +1,1 @@
1 +203.7 KB
Content