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

From version 12.1
edited by maaike
on 2022/07/06 10:10
Change comment: There is no comment for this version
To version 6.4
edited by oschmid
on 2022/06/29 15:15
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -2 Application Programming Interface (API)
1 +Programming Interface Application (API)
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.maaike
1 +XWiki.oschmid
Content
... ... @@ -2,15 +2,20 @@
2 2  
3 3  The EBRAINS Knowledge Graph provides convenient tools and APIs for the implementation of queries into your scripts.
4 4  
5 -To be able to access the Knowledge Graph (KG) programmatically, you only require an EBRAINS account. Register for an account here: [[https:~~/~~/ebrains.eu/register/>>https://ebrains.eu/register/]] and log in.
5 +=== Request permission ===
6 6  
7 -=== Writing Knowledge Graph queries ===
7 +To be able to access the Knowledge Graph (KG) programmatically, you require:
8 8  
9 -A query for the Knowledge Graph is defined declaratively in JSON-LD and is always executed against a specific data structure (e.g. a "Dataset version"), allowing the graph to be traversed.
9 +1. An EBRAINS account. Register for an account here: [[https:~~/~~/ebrains.eu/register/>>https://ebrains.eu/register/]]
10 +1. (% style="background-color:#f1c40f" %)--Register and request credentials for your KG client by emailing support@ebrains.eu--
10 10  
12 +=== Writting Knowledge Graph queries ===
13 +
14 +A query for the Knowledge Graph is defined declaratively in JSON-LD and always executed against a specific data structure (e.g. a "Dataset version") allowing the graph to be traversed.
15 +
11 11  In the snippet below, we can see that we first define the semantical context for the query with //"@context",// which belongs to the namespace "//https:~/~/schema.hbp.eu/graphQuery/".//
12 12  
13 -{{code language="json" layout="LINENUMBERS"}}
18 +{{code language="python"}}
14 14  {
15 15   "@context": {
16 16   "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
... ... @@ -61,7 +61,7 @@
61 61  (% class="wikigeneratedid" id="HSelectspecies" %)
62 62  **Select species**
63 63  
64 -We can also refine our query to only include dataset versions that use mice (mus musculus) in a similar way as the faceted filters in the Search UI.
69 +Similarly, we can refine our query for mice only.
65 65  
66 66  [[image:QBstep3.png||alt="Step 3: Select species" height="543" width="700"]]
67 67  
... ... @@ -70,11 +70,8 @@
70 70  **Access detailed metadata**
71 71  
72 72  (% class="wikigeneratedid" id="H" %)
73 -The Knowledge Graph Search UI has visualised the basic metadata. In many cases, more metadata is stored in the KG than is readily accessible via the Search UI. We can use this to our advantage when refining our query.
78 +Following
74 74  
75 -(% class="wikigeneratedid" %)
76 -For example, we can filter datasets with data from male subjects by making this a required feature in the query (set the label of "biologicalSex" to "male).
77 -
78 78  ==== [[image:QB4.png||alt="Step 4: Access detailed metadata" height="432" width="700"]] ====
79 79  
80 80  ==== ====
... ... @@ -81,7 +81,7 @@
81 81  
82 82  The above query in the Query Builder is written below:
83 83  
84 -{{code language="json" layout="LINENUMBERS"}}
86 +{{code language="python"}}
85 85  {
86 86   "@context": {
87 87   "@vocab": "https://core.kg.ebrains.eu/vocab/query/",
... ... @@ -209,3 +209,5 @@
209 209   ]
210 210  }
211 211  {{/code}}
214 +
215 +