Skip to content

Commit c103866

Browse files
committed
improve error handling when SPARQL endpoint cannot be reached
1 parent 8bfd6b6 commit c103866

File tree

2 files changed

+80
-23
lines changed

2 files changed

+80
-23
lines changed

index.html

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,75 @@
1616

1717
<body>
1818
<div>
19-
<!-- <sparql-editor endpoint="https://sparql.uniprot.org/sparql/"></sparql-editor> -->
20-
21-
<!-- <sparql-editor
22-
endpoint="https://sparql.uniprot.org/sparql/"
23-
describeLinks='["https://sparql.uniprot.org/sparql",""]'
24-
style="--btn-color: white; --btn-bg-color: #e30613;"
25-
>
26-
<p>About</p>
27-
</sparql-editor> -->
2819
<!-- <sparql-editor endpoint="https://sparql.uniprot.org/sparql/" style="--btn-bg-color: #00709b; --btn-color: white;"></sparql-editor> -->
2920

21+
<!-- UNIPROT -->
22+
<!-- <sparql-editor endpoint="https://sparql.uniprot.org/sparql/">
23+
<h4>About</h4>
24+
<p>
25+
This SPARQL endpoint contains all UniProt data. It is free to access and supports the
26+
<a href="http://www.w3.org/TR/sparql11-query/">SPARQL 1.1 Standard</a>.
27+
</p>
28+
<p>
29+
There are 0 triples in this release (2024_04). The query timeout is 45 minutes. All triples are available in
30+
the default graph. There are 21 named graphs.
31+
</p>
32+
<h4>Documentation</h4>
33+
<ol>
34+
<li><a href="http://purl.uniprot.org/core/">Classes and predicates defined by the UniProt consortium</a></li>
35+
<li>
36+
<a href="https://github.com/sib-swiss/sparql-training/tree/master/uniprot"
37+
>Tutorial on using SPARQL with UniProt</a
38+
>
39+
</li>
40+
<li><a href="/.well-known/void">Statistics and diagrams</a></li>
41+
</ol>
42+
</sparql-editor> -->
43+
44+
<!-- BGEE -->
3045
<sparql-editor endpoint="https://www.bgee.org/sparql/">
31-
<h1>About</h1>
32-
<p>Checkout <a href="">Ontology and infos...</a></p>
46+
<h3 style="text-align: center">About</h3>
47+
<p>
48+
Tutorial and documentation:
49+
<a href="https://purl.org/sib-rdf/bgee-tutorial">Querying the Bgee knowledge graph</a>
50+
</p>
51+
<p>
52+
Ontology (data schema): <a href="https://purl.org/genex/documentation">GenEx semantic model specification</a>
53+
</p>
54+
<p>Support: <a href="https://github.com/BgeeDB/bgee_pipeline/issues">open an issue here</a></p>
3355
</sparql-editor>
34-
<!-- <sparql-editor endpoint="https://sparql.omabrowser.org/sparql/"></sparql-editor> -->
56+
57+
<!-- OMA -->
58+
<!-- <sparql-editor endpoint="https://sparql.omabrowser.org/sparql/">
59+
<h3 class="space-margin space-top">About OMA SPARQL Endpoint</h3>
60+
<p class="query-text space-margin">
61+
The OMA SPARQL endpoint is reachable by using your preferable programming language or SPARQL interface through
62+
the following URL address:
63+
<a href="https://sparql.omabrowser.org/sparql">https://sparql.omabrowser.org/sparql</a>.
64+
</p>
65+
<p class="query-text space-margin">
66+
The OMA SPARQL endpoint is updated in sync with the <a href="https://omabrowser.org">OMA Browser</a>. The data
67+
of the current release as well of the previous releases
68+
<a href="https://omabrowser.org/oma/current">can be downloaded</a> from the download section of the OMA
69+
Browser as turtle files (look out for <em>OMA Browser in RDF</em>).
70+
</p>
71+
<p></p>
72+
<h3 class="space-margin">RDF Serialisation and Ontologies</h3>
73+
<p class="query-text space-margin">
74+
The RDF serialisation of the OMA Hierarchical Orthologous Groups is based on the
75+
<a href="https://qfo.github.io/OrthologyOntology/">ORTH ontology specification</a> in the context of the Quest
76+
for Orthologs (QfO) consortium (see GitHub repository
77+
<a href="https://github.com/qfo/OrthologyOntology">here</a>).
78+
</p>
79+
<p></p>
80+
<p class="query-text space-margin space-bottom">
81+
To cross-reference other resources, this SPARQL endpoint contains annotation property assertions defined by a
82+
first draft of the life-sciences cross-reference (LSCR) ontology that is available to download at the Quest
83+
for Orthologs github repository <a href="https://github.com/qfo/OrthologyOntology">here</a> -
84+
<a href="https://github.com/qfo/OrthologyOntology/blob/master/lscr.ttl">lscr.ttl</a> file.
85+
</p>
86+
</sparql-editor> -->
87+
3588
<!-- <sparql-editor endpoint="https://beta.sparql.swisslipids.org/sparql/"></sparql-editor> -->
3689
</div>
3790

src/sparql-editor.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export class SparqlEditor extends HTMLElement {
218218
}
219219
return clsList;
220220
} catch (error) {
221-
console.warn("Error retrieving autocomplete for classes:", error);
221+
console.warn(`Error retrieving classes for autocomplete from ${this.endpointUrl} VoID description:`, error);
222222
return [];
223223
}
224224
},
@@ -243,7 +243,7 @@ export class SparqlEditor extends HTMLElement {
243243
}
244244
return propsList;
245245
} catch (error) {
246-
console.warn("Error retrieving autocomplete for properties:", error);
246+
console.warn(`Error retrieving properties for autocomplete from ${this.endpointUrl} VoID description:`, error);
247247
return [];
248248
}
249249
},
@@ -323,13 +323,17 @@ export class SparqlEditor extends HTMLElement {
323323
}
324324

325325
async getPrefixes() {
326-
const response = await fetch(
327-
`${this.endpointUrl}?format=json&ac=1&query=PREFIX sh: <http://www.w3.org/ns/shacl%23> SELECT ?prefix ?namespace WHERE { [] sh:namespace ?namespace ; sh:prefix ?prefix} ORDER BY ?prefix`,
328-
);
329-
const json = await response.json();
330-
json.results.bindings.forEach((b: any) => {
331-
this.prefixes.set(b.prefix.value, b.namespace.value);
332-
});
326+
try {
327+
const response = await fetch(
328+
`${this.endpointUrl}?format=json&ac=1&query=PREFIX sh: <http://www.w3.org/ns/shacl%23> SELECT ?prefix ?namespace WHERE { [] sh:namespace ?namespace ; sh:prefix ?prefix} ORDER BY ?prefix`,
329+
);
330+
const json = await response.json();
331+
json.results.bindings.forEach((b: any) => {
332+
this.prefixes.set(b.prefix.value, b.namespace.value);
333+
});
334+
} catch (error) {
335+
console.warn(`Error retrieving Prefixes from ${this.endpointUrl}:`, error);
336+
}
333337
}
334338

335339
async getVoidDescription() {
@@ -368,7 +372,7 @@ WHERE {
368372
}
369373
});
370374
} catch (error) {
371-
console.warn("Error retrieving VoID description for autocomplete:", error);
375+
console.warn(`Error retrieving VoID description from ${this.endpointUrl} for autocomplete:`, error);
372376
}
373377
}
374378

@@ -518,7 +522,7 @@ SELECT DISTINCT ?sq ?comment ?query WHERE {
518522
document.body.style.overflow = "";
519523
});
520524
} catch (error) {
521-
console.warn("Error fetching or processing example queries:", error);
525+
console.warn(`Error fetching or processing example queries from ${this.endpointUrl}:`, error);
522526
}
523527
}
524528

0 commit comments

Comments
 (0)