Changes for page 2 Application Programming Interface (API)
Last modified by maaike on 2022/07/06 10:10
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 -2 ApplicationProgramming Interface (API)1 +2 Programming Interface Application (API) - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.m aaike1 +XWiki.oschmid - Content
-
... ... @@ -2,15 +2,17 @@ 2 2 3 3 The EBRAINS Knowledge Graph provides convenient tools and APIs for the implementation of queries into your scripts. 4 4 5 +=== Request permission === 6 + 5 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. 6 6 7 7 === Writing Knowledge Graph queries === 8 8 9 -A query for the Knowledge Graph is defined declaratively in JSON-LD and isalways executed against a specific data structure (e.g. a "Dataset version"),allowing the graph to be traversed.11 +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. 10 10 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"}}15 +{{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 canalsorefine our querytoonly include dataset versionsthat usemice(mus musculus) ina similar wayas the faceted filters in the Search UI.66 +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 advantagewhen refiningour query.75 +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"}}83 +{{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}} 211 + 212 +