3 Try it yourself!
User examples
- How many datasets used human subjects?
- Find datasets with male adult subjects
- Find datasets that contain NIfTI files
- Find the software that can be used to open .smr file formats?
Log in to your EBRAINS account and try running the examples yourself!
Example 1 - How many datasets used human subjects?
Search UI
In the filter function, select "Homo Sapiens" under species. This filters the available datasets in the Knowledge Graph for human subjects only.
Query Builder
To search for datasets containing human subjects only, we will therefore execute the query against the "dataset version" data structure. We want to know the persistent identifier and name of the dataset version, so we declare the "id" and "lookup label" first. Since our objective is to filter dataset based on the species of the subjects, we need to specify "sudied specimen" in our query too. We have four specimen categories, "subjects", "subject group", "tissue sample", and "tissue sample collection". We add a "type filter" to restrict our results to "Subject" and "Subject group" since we are not currently not interested in "Tissue samples" and "Tissue sample collections". To ensure that we only get datasets with human subjects, we can define the "Species" under "studied specimen" (again, you can 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".
For graph databases, like the EBRAINS Knowledge Graph, it is very easy to create very long and complex queries. We can simplify deeply nested structures by "flattening" the query. This is only possible when a property only has 1 nested property ("child"). In our query, this is the case for the "Studied specimen" and the "Species".
Once we have build your query, we can go to the "execute query" section (the play button on the left) and run the query, we can see the total number of dataset versions.
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.
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"@context": {
"@vocab": "https://core.kg.ebrains.eu/vocab/query/",
"query": "https://schema.hbp.eu/myQuery/",
"propertyName": {
"@id": "propertyName",
"@type": "@id"
},
"path": {
"@id": "path",
"@type": "@id"
}
},
"meta": {
"type": "https://openminds.ebrains.eu/core/DatasetVersion",
"responseVocab": "https://schema.hbp.eu/myQuery/"
},
"structure": [
{
"propertyName": "query:shortName",
"path": "https://openminds.ebrains.eu/vocab/shortName"
},
{
"propertyName": "query:id",
"path": "@id"
},
{
"propertyName": "query:studiedSpecimen",
"required": true,
"filter": {
"op": "CONTAINS",
"value": "Homo sapiens"
},
"path": [
{
"@id": "https://openminds.ebrains.eu/vocab/studiedSpecimen",
"typeFilter": [
{
"@id": "https://openminds.ebrains.eu/core/Subject"
},
{
"@id": "https://openminds.ebrains.eu/core/SubjectGroup"
}
]
},
{
"@id": "https://openminds.ebrains.eu/vocab/species",
"typeFilter": [
{
"@id": "https://openminds.ebrains.eu/controlledTerms/Species"
}
]
},
"https://openminds.ebrains.eu/vocab/name"
]
}
]
}
Example 2 - Find datasets with male adult subjects
Search UI
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). 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.
Query Builder
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.
We are showing the unflattened query here. You can take advantage of the type filter (set it to subjects and subject groups), and flatten the query where possible. The query will look different; there will be multiple elements in the "path" for "biological sex" and for the "age category".
Try it yourself and check out the differences between the results of the flattened and unflattened queries! Hint: look at the indexing of elements within your results!
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"@context": {
"@vocab": "https://core.kg.ebrains.eu/vocab/query/",
"query": "https://schema.hbp.eu/myQuery/",
"propertyName": {
"@id": "propertyName",
"@type": "@id"
},
"path": {
"@id": "path",
"@type": "@id"
}
},
"meta": {
"responseVocab": "https://schema.hbp.eu/myQuery/",
"type": "https://openminds.ebrains.eu/core/DatasetVersion"
},
"structure": [
{
"propertyName": "query:shortName",
"path": "https://openminds.ebrains.eu/vocab/shortName"
},
{
"propertyName": "query:id",
"path": "@id"
},
{
"propertyName": "query:studiedSpecimen",
"path": {
"@id": "https://openminds.ebrains.eu/vocab/studiedSpecimen",
"typeFilter": [
{
"@id": "https://openminds.ebrains.eu/core/Subject"
},
{
"@id": "https://openminds.ebrains.eu/core/SubjectGroup"
}
]
},
"required": true,
"structure": [
{
"propertyName": "query:lookupLabel",
"path": "https://openminds.ebrains.eu/vocab/lookupLabel"
},
{
"propertyName": "query:id",
"path": "@id"
},
{
"propertyName": "query:biologicalSex",
"path": "https://openminds.ebrains.eu/vocab/biologicalSex",
"required": true,
"structure": {
"propertyName": "query:name",
"path": "https://openminds.ebrains.eu/vocab/name",
"filter": {
"op": "EQUALS",
"value": "male"
}
}
},
{
"propertyName": "query:studiedState",
"path": "https://openminds.ebrains.eu/vocab/studiedState",
"required": true,
"structure": {
"propertyName": "query:ageCategory",
"path": "https://openminds.ebrains.eu/vocab/ageCategory",
"required": true,
"structure": {
"propertyName": "query:name",
"path": "https://openminds.ebrains.eu/vocab/name",
"required": true,
"filter": {
"op": "EQUALS",
"value": "adult"
}
}
}
}
]
}
]
}
Example 3 - Find datasets that contain NIfTI files
Search UI
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.
Query Builder
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.
For these examples, we are showing the unflattened version of the query. Try it yourself to create a flattened version!
Query datasets based on file extension
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 nifti files.
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"@context": {
"@vocab": "https://core.kg.ebrains.eu/vocab/query/",
"query": "https://schema.hbp.eu/myQuery/",
"propertyName": {
"@id": "propertyName",
"@type": "@id"
},
"path": {
"@id": "path",
"@type": "@id"
}
},
"meta": {
"type": "https://openminds.ebrains.eu/core/DatasetVersion",
"responseVocab": "https://schema.hbp.eu/myQuery/"
},
"structure": [
{
"propertyName": "query:shortName",
"path": "https://openminds.ebrains.eu/vocab/shortName"
},
{
"propertyName": "query:id",
"path": "@id"
},
{
"propertyName": "query:repository",
"path": "https://openminds.ebrains.eu/vocab/repository",
"required": true,
"structure": {
"propertyName": "query:fileRepository",
"path": {
"@id": "https://openminds.ebrains.eu/vocab/fileRepository",
"reverse": true
},
"required": true,
"structure": {
"propertyName": "query:name",
"path": "https://openminds.ebrains.eu/vocab/name",
"required": true,
"filter": {
"op": "ENDS_WITH",
"value": ".nii.gz"
}
}
}
}
]
}
Query datasets based on content type
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".
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"@context": {
"@vocab": "https://core.kg.ebrains.eu/vocab/query/",
"query": "https://schema.hbp.eu/myQuery/",
"propertyName": {
"@id": "propertyName",
"@type": "@id"
},
"path": {
"@id": "path",
"@type": "@id"
}
},
"meta": {
"type": "https://openminds.ebrains.eu/core/DatasetVersion",
"responseVocab": "https://schema.hbp.eu/myQuery/"
},
"structure": [
{
"propertyName": "query:shortName",
"path": "https://openminds.ebrains.eu/vocab/shortName"
},
{
"propertyName": "query:id",
"path": "@id"
},
{
"propertyName": "query:repository",
"path": "https://openminds.ebrains.eu/vocab/repository",
"required": true,
"structure": {
"propertyName": "query:contentTypePattern",
"path": "https://openminds.ebrains.eu/vocab/contentTypePattern",
"required": true,
"structure": {
"propertyName": "query:contentType",
"path": "https://openminds.ebrains.eu/vocab/contentType",
"required": true,
"structure": {
"propertyName": "query:name",
"path": "https://openminds.ebrains.eu/vocab/name",
"required": true,
"filter": {
"op": "CONTAINS",
"value": "nifti"
}
}
}
}
}
]
}
Example 4 - Find the software that can be used to open .smr file formats?
Search UI
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.
https://search.kg.ebrains.eu/?category=Software&inputFormats[0]=application%2Fvnd.spike2.sonpy.son
Query Builder
For this question, we will execute the query against the "softwareVersion data structure. We ask for the name, version and input type of the software. We further refine our query by restricting the result to software that can open files with the file extension ".smr". We get the same 3 software types as in the search, and we immediately see that one of the software types has multiple versions that can open this kind of files.
(This query is not flattened).
You may have noticed that even though you can get the same results in the Search UI and the Query Builder, the details you need to define to get to that result are not always the same. For example, in the query we can rely on the file extension (i.e. ".smr"), whereas in the Search UI we sometimes need to have specific details about the file you are trying to open, such as the software/data aquisition/analysis package (i.e. Spike2) that was used. You may keep this is mind when tackling a particular question. Queries can be made as detailed and broad as you want, whereas the Search UI is a snapshot of the most common and basic information that is available.
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"@context": {
"@vocab": "https://core.kg.ebrains.eu/vocab/query/",
"query": "https://schema.hbp.eu/myQuery/",
"propertyName": {
"@id": "propertyName",
"@type": "@id"
},
"path": {
"@id": "path",
"@type": "@id"
}
},
"meta": {
"type": "https://openminds.ebrains.eu/core/SoftwareVersion",
"responseVocab": "https://schema.hbp.eu/myQuery/"
},
"structure": [
{
"propertyName": "query:id",
"path": "@id"
},
{
"propertyName": "query:shortName",
"path": "https://openminds.ebrains.eu/vocab/shortName"
},
{
"propertyName": "query:versionIdentifier",
"path": "https://openminds.ebrains.eu/vocab/versionIdentifier"
},
{
"propertyName": "query:inputFormat",
"path": "https://openminds.ebrains.eu/vocab/inputFormat",
"required": true,
"structure": [
{
"propertyName": "query:name",
"path": "https://openminds.ebrains.eu/vocab/name"
},
{
"propertyName": "query:fileExtension",
"path": "https://openminds.ebrains.eu/vocab/fileExtension",
"required": true,
"filter": {
"op": "CONTAINS",
"value": ".smr"
}
}
]
}
]
}