Skip to content

Commit

Permalink
Including the sparql UI page - powering sparql.geneontology.org
Browse files Browse the repository at this point in the history
  • Loading branch information
lpalbou committed Jan 11, 2021
1 parent 7073ad4 commit 66d6675
Showing 1 changed file with 365 additions and 0 deletions.
365 changes: 365 additions & 0 deletions sparql.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,365 @@
<html>

<head>
<title>Gene Ontology SPARQL endpoint</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="http://www.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;
}

#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: 10px 10px 10px 15px;
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>


// utility function to remove verbosity when creating tabs (SPARQL query)
function addTab(yasgui, name, active = true) {
var tabConfig = { ...Yasgui.Tab.getDefaults(), name: name };
tabConfig.requestConfig = { endpoint: "http://rdf.geneontology.org/blazegraph/sparql" };
var newTab = yasgui.addTab(
active, // set as active tab
tabConfig
);
return newTab
}


// 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">

<!-- Panel including title, breadcrumbs, and controls -->
<div class="panel-heading clearfix">
<!-- Title and breadcrumbs -->
<div class="btn-group pull-left">
<!-- App title -->
<div class="pull-left logo" style="margin-top: 10px;">
<a href="http://www.geneontology.org">
<img src="https://geneontology-public.s3.amazonaws.com/assets/go-logo.large.png">
</a>
</div>

</div>

<h1>
Gene Ontology SPARQL endpoint
</h1>


<!-- SOCIAL LINKS -->
<div class="navbar-right">
<ul class="nav navbar-nav" style="padding-top: 14px;">
<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>

<div class="panel-body">

<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: http://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="http://geneontology.org/docs/sparql/">GO SPARQL documentation</a> ]
<br><br>

<div id="yasgui"></div>
<script>
const yasgui = new Yasgui(document.getElementById("yasgui"), {
requestConfig: { endpoint: "http://rdf.geneontology.org/blazegraph/sparql" },
copyEndpointOnNewTab: false,
autoAddOnInit: false,
persistencyExpire : 1,
});

addDefaultQueries(yasgui);

// window.addEventListener("onunload", e => {
// yasgui.destroy();
// })

</script>
</div>

</div>
</div>
</div>
</div>


</body>


</html>

0 comments on commit 66d6675

Please sign in to comment.