Skip to content

Commit 4cd5bde

Browse files
committed
Allow alternativeEngines links to be defined
1 parent ada56eb commit 4cd5bde

File tree

4 files changed

+52
-5
lines changed

4 files changed

+52
-5
lines changed

index.html

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,27 @@ <h1><a href="#">Query the Web of Linked Data</a></h1>
114114
<pre class="log"></pre>
115115
</li>
116116
</ul>
117+
118+
<p class="alternative-engines">
119+
<label>Or try an alternative Comunica engine</label>
120+
<select class="alternative-engines-select">
121+
<option value="">Loading alternative engines...</option>
122+
</select>
123+
</p>
117124
</fieldset>
118125

119126
<p>
120-
Discover how <a href="http://linkeddatafragments.org" target="_blank">Linked Data Fragments</a>
121-
enable Web-scale querying of Linked Data.
127+
Discover how <a href="https://comunica.dev/" target="_blank">Comunica</a>
128+
enables Web-scale querying of Knowledge Graphs.
122129
</p>
123130
</main>
124131

125132
<footer>
126133
<p>
127134
©2013–now
128135
<a href="http://www.ugent.be/" target="_blank">Ghent University</a>
129-
<a href="http://www.imec.be/" target="_blank">imec</a>, Belgium.
130-
<a href="https://github.com/comunica/jQuery-Widget.js">Source code</a>.
136+
<a href="http://www.imec.be/" target="_blank">imec</a>, Belgium.<br />
137+
Source code of <a href="https://github.com/comunica/comunica">Comunica</a> and this <a href="https://github.com/comunica/jQuery-Widget.js">Web client</a>.
131138
<p id="comunica-version"></p>
132139
</p>
133140
</footer>

settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,13 @@
111111
"bow": "https://betweenourworlds.org/ontology/",
112112
"lc": "http://semweb.mmlab.be/ns/linkedconnections#"
113113
},
114+
"alternativeEngines": {
115+
"Default": "https://query.comunica.dev/",
116+
"Link Traversal Solid (default)": "https://comunica.github.io/comunica-feature-link-traversal-web-clients/builds/solid-default/",
117+
"Link Traversal Solid (single pod)": "https://comunica.github.io/comunica-feature-link-traversal-web-clients/builds/solid-single-pod/",
118+
"Link Traversal (default)": "https://comunica.github.io/comunica-feature-link-traversal-web-clients/builds/default/",
119+
"Link Traversal (follow all)": "https://comunica.github.io/comunica-feature-link-traversal-web-clients/builds/follow-all/",
120+
"Link Traversal (TREE)": "https://comunica.github.io/comunica-feature-link-traversal-web-clients/builds/tree/"
121+
},
114122
"queries": "(Will be generated from the 'queries' folder by running the './queries-to-json' script.)"
115123
}

src/ldf-client-ui.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ if (typeof global.process === 'undefined')
8787
datasources: [],
8888
queries: [],
8989
prefixes: [],
90+
alternativeEngines: {},
9091
},
9192

9293
// Initializes the widget
@@ -115,7 +116,9 @@ if (typeof global.process === 'undefined')
115116
$executeOnLoad = this.$executeOnLoad = $('.executeOnLoad', $element),
116117
$solidIdp = this.$solidIdp = $('.solid-auth .idp', $element),
117118
$showDetails = this.$showDetails = $('.details-toggle', $element),
118-
$proxyDefault = $('.proxy-default', $element);
119+
$proxyDefault = $('.proxy-default', $element),
120+
$alternativeEngines = this.$alternativeEngines = $('.alternative-engines-select', $element);
121+
this.$alternativeEnginesWrapper = $('.alternative-engines', $element);
119122
this.$details = $('.details', $element);
120123

121124
// Replace non-existing elements by an empty text box
@@ -268,6 +271,12 @@ if (typeof global.process === 'undefined')
268271
return false;
269272
});
270273

274+
// Handle alternative engine clicks
275+
$alternativeEngines.on('change', function () {
276+
document.location.href = $alternativeEngines.val();
277+
return false;
278+
});
279+
271280
// Apply all options
272281
for (var key in options)
273282
this._setOption(key, options[key], true);
@@ -606,6 +615,18 @@ if (typeof global.process === 'undefined')
606615
case 'allowNoSources':
607616
this.$allowNoSources = value;
608617
break;
618+
// Initialize alternative engines
619+
case 'alternativeEngines':
620+
this.$alternativeEngines.find('option').remove().end();
621+
for ([key, value] of Object.entries(value)) {
622+
const option = $('<option />').text(key).val(value);
623+
if (document.location.href.startsWith(value))
624+
option.attr('selected', 'selected');
625+
this.$alternativeEngines.append(option);
626+
}
627+
if (Object.keys(value).length > 1)
628+
this.$alternativeEnginesWrapper.show();
629+
break;
609630
// Load settings from a JSON resource
610631
case 'settings':
611632
$.getJSON(value, function (settings) {

styles/ldf-client.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,3 +730,14 @@ li.search-choice-focus .search-choice-close {
730730
.extra-information.highlighted {
731731
background-color: grey;
732732
}
733+
734+
.alternative-engines {
735+
display: none;
736+
label {
737+
display: inline-block;
738+
width: 312px;
739+
}
740+
select {
741+
width: 330px;
742+
}
743+
}

0 commit comments

Comments
 (0)