-
Notifications
You must be signed in to change notification settings - Fork 10
/
sparql.html
444 lines (351 loc) · 17.1 KB
/
sparql.html
1
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
---
layout: default-no-nav
permalink: /sparql.html
---
<html>
<head>
<title>Gene Ontology SPARQL endpoint (deprecated 2024)</title>
<link rel="shortcut icon" href="https://geneontology.org/favicon.ico">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css" integrity="sha384-PmY9l28YgO4JwMKbTvgaS7XNZJ30MK9FAZjjzXtlqyZCqBY6X6bXIkM++IkyinN+" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap-theme.min.css" integrity="sha384-jzngWsPS6op3fgRCDTESqrEJwRKck+CILhJVO5VvaAZCq8JYf8HsR/HPpBOOPZfR" crossorigin="anonymous">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="https://geneontology-public.s3.amazonaws.com/assets/font-awesome.min.css">
<link href="https://unpkg.com/@triply/yasgui/build/yasgui.min.css" rel="stylesheet" type="text/css" />
<script src="https://unpkg.com/@triply/yasgui/build/yasgui.min.js"></script>
<style>
.yasgui .autocompleteWrapper {
display: none !important;
}
.yasr .yasr_header {
height: 100px;
}
#wrapper {
padding-left: 0;
}
#page-wrapper {
width: 100%;
}
#tb-s3objects {
width: 100% !Important;
}
a {
color: rgb(73, 101, 194);
}
body {
font-family: "Lato", sans-serif;
font-size: 16px;
line-height: 1.6;
}
td {
font: 12px "Lucida Grande", Helvetica, Arial, sans-serif;
}
.title {
padding: 6px 12px;
}
.breadcrumb {
margin-bottom: 0;
}
#navbuttons .btn {
padding: 3px 6px;
}
blockquote {
font-size: 14px;
font-style: italic
}
p {
margin: 10 0 10px;
}
h1 {
display: inline-block;
font-size: 34px;
color: #4965c2;
margin-top: 10px;
}
.padding-right {
padding-right: 12px;
}
.logo img {
width: 175px;
margin-right: 30px
}
.panel-heading {
padding: 0px 10px;
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.30);
}
.panel-body {
max-width: 90%;
margin: 0 auto;
}
.small-margin {
margin: 2px 2px;
}
.disclaimer {
margin: 3rem 0rem 6rem 0rem;
}
</style>
<script>
// change this endpoint if you plan to use this page for another page
let sparqlEndpoint = "https://rdf.geneontology.org/blazegraph/sparql";
// utility function to remove verbosity when creating tabs (SPARQL query)
// note: can override the endpoint variable for tab-specific sparql endpoint
function addTab(yasgui, name, active = true, endpoint = sparqlEndpoint) {
var tabConfig = { ...Yasgui.Tab.getDefaults(), name: name };
tabConfig.requestConfig = { endpoint: endpoint };
var newTab = yasgui.addTab(
active, // set as active tab
tabConfig
);
return newTab
}
// utility function to fetch some data and call a cb function when done
function fetchData(URL, cb) {
var oReq = new XMLHttpRequest();
oReq.onload = cb;
oReq.open("GET", URL);
oReq.send();
}
// add an empty query tab, useful for users to start creating query right away
function addEmptyQueryTab(yasgui, name = "Your Query") {
var tabEmptyQuery = addTab(yasgui, name);
tabEmptyQuery.setQuery(`
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT * WHERE {
?sub ?pred ?val
}`);
tabEmptyQuery.yasqe.autoformat();
yasgui.selectTabId(tabEmptyQuery.persistentJson.id);
}
// add a SPARQL query to the current yasgui instance, from a URL
// note 1: there is no check on the validity of the URL nor its content
// note 2: if a #+ endpoint: field is provided, will update the endpoint used for that query
function addQueryFrom(yasgui, URL, active = true) {
fetchData(URL, (response) => {
let text = response.target.response;
// Title strategy 1: by default from the URL
let title = response.target.responseURL.split("/");
title = title[title.length - 1];
if(title.includes("\.")) { title = title.substring(0, title.indexOf(".")); }
// Title strategy 2: if #+ summary field present
if(text.includes("#+ summary: ")) {
title = text.substring(text.indexOf("#+ summary: ") + 12).trim();
title = title.substring(0, title.indexOf("\n")).trim();
}
// endpoint is the general one unless specify in the query itself
let endpoint = sparqlEndpoint;
if(text.includes("#+ endpoint: ")) {
endpoint = text.substring(text.indexOf("#+ endpoint: ") + 13).trim();
endpoint = endpoint.substring(0, endpoint.indexOf("\n")).trim();
}
// finally create and add the tab to yasgui
let query = text;
var tab_gocams = addTab(yasgui, title, active, endpoint);
tab_gocams.setQuery(query);
tab_gocams.yasqe.autoformat();
})
}
// same as above, but work with an array of URLs
function addQueriesFrom(yasgui, URLs) {
for(let URL of URLs) {
addQueryFrom(yasgui, URL);
}
}
// the default queries are hard coded here from the documentation
// https://geneontology.org/docs/sparql/
// ideally however, this would be fed from SPARQLr - a template query system repository
function addDefaultQueries(yasgui) {
var tab_your_query = addTab(yasgui, "Your Query");
tab_your_query.setQuery(`
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX metago: <http://model.geneontology.org/>
PREFIX definition: <http://purl.obolibrary.org/obo/IAO_0000115>
PREFIX enabled_by: <http://purl.obolibrary.org/obo/RO_0002333>
PREFIX BP: <http://purl.obolibrary.org/obo/GO_0008150>
PREFIX MF: <http://purl.obolibrary.org/obo/GO_0003674>
PREFIX CC: <http://purl.obolibrary.org/obo/GO_0005575>
SELECT * WHERE {
?sub ?pred ?obj
}
LIMIT 10
`);
tab_your_query.yasqe.autoformat();
var tab_gocams = addTab(yasgui, "List GO-CAMs");
tab_gocams.setQuery(`
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX metago: <http://model.geneontology.org/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?gocam ?date ?title WHERE {
GRAPH ?gocam {
?gocam metago:graphType metago:noctuaCam .
?gocam dc:title ?title ;
dc:date ?date .
}
}
ORDER BY DESC(?date)`);
tab_gocams.yasqe.autoformat();
var tab_gocams_triples = addTab(yasgui, "List GO-CAM triples");
tab_gocams_triples.setQuery(`
SELECT * WHERE {
GRAPH <http://model.geneontology.org/5b91dbd100001993> {
?sub ?pred ?obj .
}
}`);
tab_gocams_triples.yasqe.autoformat();
var tab_gocam_genes = addTab(yasgui, "List GO-CAM genes");
tab_gocam_genes.setQuery(`
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX metago: <http://model.geneontology.org/>
PREFIX enabled_by: <http://purl.obolibrary.org/obo/RO_0002333>
SELECT distinct ?identifier ?name
WHERE {
GRAPH metago:5b91dbd100001993 {
?s enabled_by: ?gpnode .
?gpnode rdf:type ?identifier .
}
?identifier rdfs:label ?name
}`);
tab_gocam_genes.yasqe.autoformat();
var tab_gocam_go = addTab(yasgui, "List GO-CAM GO terms");
tab_gocam_go.setQuery(`
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX metago: <http://model.geneontology.org/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX definition: <http://purl.obolibrary.org/obo/IAO_0000115>
PREFIX BP: <http://purl.obolibrary.org/obo/GO_0008150>
PREFIX MF: <http://purl.obolibrary.org/obo/GO_0003674>
PREFIX CC: <http://purl.obolibrary.org/obo/GO_0005575>
SELECT distinct ?goaspect ?goids ?gonames ?definitions WHERE {
GRAPH metago:5b91dbd100001993 {
?entity rdf:type owl:NamedIndividual .
?entity rdf:type ?goids
}
VALUES ?goaspect { BP: MF: CC: } .
?goids rdfs:subClassOf+ ?goaspect .
?goids rdfs:label ?gonames .
?goids definition: ?definitions .
}
ORDER BY DESC(?gocam)
`);
tab_gocam_go.yasqe.autoformat();
var tab_gocam_with_gene = addTab(yasgui, "List GO-CAMs with gene");
tab_gocam_with_gene.setQuery(`
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX metago: <http://model.geneontology.org/>
PREFIX enabled_by: <http://purl.obolibrary.org/obo/RO_0002333>
SELECT distinct ?gocam WHERE {
GRAPH ?gocam {
?gocam metago:graphType metago:noctuaCam .
?entity enabled_by: ?gpnode .
?gpnode rdf:type ?identifier .
FILTER( ?identifier = <http://identifiers.org/mgi/MGI:98364> ) .
}
}
`);
tab_gocam_with_gene.yasqe.autoformat();
var tab_gocam_with_go = addTab(yasgui, "List GO-CAMs with GO term");
tab_gocam_with_go.setQuery(`
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX metago: <http://model.geneontology.org/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT distinct ?gocam WHERE {
GRAPH ?gocam {
?gocam metago:graphType metago:noctuaCam .
?entity rdf:type owl:NamedIndividual .
?entity rdf:type ?identifier .
FILTER( ?identifier = <http://purl.obolibrary.org/obo/GO_0051402> )
}
}
`);
tab_gocam_with_go.yasqe.autoformat();
yasgui.selectTabId(tab_your_query.persistentJson.id);
}
</script>
</head>
<body>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<div class="panel">
<!-- Page navigation bar -->
<div class="panel-heading clearfix">
<!-- Container for logo -->
<div class="btn-group pull-left">
<div class="pull-left logo" style="transform: translate(0px, 25%);">
<a href="https://geneontology.org" class="basic-link">
<img src="https://geneontology-public.s3.amazonaws.com/assets/go-logo.large.png">
</a>
</div>
</div>
<!-- Title -->
<h1>Gene Ontology SPARQL endpoint</h1>
<!-- Social Links -->
<div class="navbar-right">
<ul class="nav navbar-nav">
<li>
<a href="https://github.com/geneontology" target="blank" style="padding: 8px 3px; font-size: 15px;">
<i class="fa fa-github padding-right" aria-hidden="true"></i>
</a>
</li>
<li>
<a href="https://twitter.com/news4go" target="blank" style="padding: 8px 3px; font-size: 15px;">
<i class="fa fa-twitter padding-right" aria-hidden="true"></i>
</a>
</li>
<li style="margin-right: 5px">
<a href="https://www.facebook.com/pages/Gene-Ontology/305908656519" target="blank" style="padding: 8px 3px; font-size: 15px;">
<i class="fa fa-facebook padding-right" aria-hidden="true"></i>
</a>
</li>
</ul>
<a href="https://www.alliancegenome.org" target="blank" alt="Alliance of Genome Resources" style="padding-right: 10px;">
<img src="https://geneontology-public.s3.amazonaws.com/assets/ALLIANCE-logo-nobackground_foundingmember.png" alt="Alliance of Genome Resources"
style="height: 60px; margin-right: 10px;" />
</a>
</div>
</div>
<!-- Page main content -->
<div class="panel-body">
<!-- General welcome / description content -->
<p>
<br>
<b>Note: As of 2024, GO is deprecating our public SPARQL endpoint, with plans to deprecate all related products in the future.</b> The information on this page is for historical purposes only. Please contact the <a href="https://help.geneontology.org/" target=blank>GO Helpdesk</a> with any questions.
<br>
<br>
The <b>GO SPARQL endpoint</b> is the entry point to query GO data from the GO quad store. This page uses the Yasgui editor and functionalities are further described in [ <a href="https://triply.cc/docs/yasgui" target=blank>Yasgui documentation</a> ]<br>
<br>
Programmatic access are to used the following endpoint: https://rdf.geneontology.org/blazegraph/sparql<br>
<br>
Click on the tabs below to explore query examples on GO-CAMs or use the "Your Query" tab to start designing your query. If you are new to SPARQL and GO-CAM, please refer to our [ <a href="https://geneontology.org/docs/sparql" target=blank>GO SPARQL documentation</a> ]
<br><br>
</p>
<!-- Actual widget to handle the SPARQL queries -->
<div id="yasgui"></div>
<script>
const yasgui = new Yasgui(document.getElementById("yasgui"), {
requestConfig: { endpoint: sparqlEndpoint },
copyEndpointOnNewTab: false,
autoAddOnInit: false,
persistencyExpire : 1,
});
addDefaultQueries(yasgui);
// Following are provided as examples as how to add queries from URLs
// addEmptyQueryTab(yasgui);
// addQueryFrom(yasgui, "https://raw.githubusercontent.com/Knowledge-Graph-Hub/kg-covid-19/master/queries/query-07-drug-to-drug-target.rq")
// addQueriesFrom(yasgui, ["https://raw.githubusercontent.com/Knowledge-Graph-Hub/kg-covid-19/master/queries/query-07-drug-to-drug-target.rq", "https://raw.githubusercontent.com/Knowledge-Graph-Hub/kg-covid-19/master/queries/query-05-sars-cov-2-interactors_druggable_2nd_order.rq"])
</script>
</div>
</div>
</div>
</div>
</div>
</body>
</html>