Sparnatural
Sparnatural copied to clipboard
`rdf:type` gone in new release?
when using the recent sparnatural.js
(https://github.com/sparna-git/Sparnatural/releases/tag/9.5.2) and sparnatural.js.map
all rdf:type
predicates are gone, causing a timeout (see https://github.com/epoz/shmarql/issues/25)
This has been my query until now:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT (COUNT(DISTINCT ?object_8) AS ?object_8_count) ?place_4_label ?place_4 WHERE {
?place_1 rdf:type <http://www.graceful17.org/ontology/place>;
(<http://www.graceful17.org/ontology/falls_within>+) ?place_4.
?place_4 rdf:type <http://www.graceful17.org/ontology/place>;
<http://www.graceful17.org/ontology/called> ?place_4_label;
<http://www.graceful17.org/ontology/has_main_type> <http://www.graceful17.org/resources/type_77>.
?place_1 ^<http://www.graceful17.org/ontology/primary_place> ?institution_6.
?institution_6 rdf:type <http://www.graceful17.org/ontology/institution>;
<http://www.graceful17.org/ontology/holds_immaterial_object> ?object_8.
?object_8 rdf:type <http://www.graceful17.org/ontology/object>;
<http://www.graceful17.org/ontology/called> ?object_8_label;
<http://www.graceful17.org/ontology/has_main_type> <http://www.graceful17.org/resources/type_460>.
}
GROUP BY ?place_4 ?place_4_label
ORDER BY DESC (?object_8_count)
LIMIT 10000
And now is:
SELECT DISTINCT (COUNT(DISTINCT ?object_8) AS ?object_8_count) ?place_4 ?place_4_label WHERE {
?place_1 (<http://www.graceful17.org/ontology/falls_within>+) ?place_4.
?place_4 <http://www.graceful17.org/ontology/called> ?place_4_label;
<http://www.graceful17.org/ontology/has_main_type> <http://www.graceful17.org/resources/type_77>.
?place_1 ^<http://www.graceful17.org/ontology/primary_place> ?institution_6.
?institution_6 <http://www.graceful17.org/ontology/holds_immaterial_object> ?object_8.
?object_8 <http://www.graceful17.org/ontology/called> ?object_8_label;
<http://www.graceful17.org/ontology/has_main_type> <http://www.graceful17.org/resources/type_460>.
}
GROUP BY ?place_4 ?place_4_label
ORDER BY DESC (?object_8_count)
LIMIT 10000
I guess this is not intended behavior?
typePredicate
is not set in the config in index.html
My main.js
// reference to the sparnatural webcomponent
const sparnatural = document.querySelector("spar-natural");
// display on the page the endpoint URL with which sparnatural is configured
document.querySelector("#displayEndpoint").setAttribute("href", sparnatural.getAttribute("endpoint"));
document.querySelector("#displayEndpoint").textContent = sparnatural.getAttribute("endpoint");
// init yasQE query editor
const yasqe = new Yasqe(document.getElementById("yasqe"), {
requestConfig: {
// make sure the endpoint is the same as sparnatural
endpoint: sparnatural.getAttribute("endpoint"),
method: "GET",
header: {}
},
copyEndpointOnNewTab: false
});
// init yasR result display
// register a specific plugin that is capable of displaying clikable label + URI
Yasr.registerPlugin("LabelledUriTable",SparnaturalYasguiPlugins_small.TableX);
Yasr.registerPlugin("Map", SparnaturalYasguiPlugins.MapPlugin);
Yasr.registerPlugin("GridPlugin", SparnaturalYasguiPlugins.GridPlugin);
Yasr.registerPlugin("StatsPlugin", SparnaturalYasguiPlugins.StatsPlugin);
Yasr.registerPlugin("Response", SparnaturalYasguiPlugins.Response);
delete Yasr.plugins['table'];
const yasr = new Yasr(document.getElementById("yasr"), {
pluginOrder: ["LabelledUriTable", "Response", "Map", "GridPlugin", "StatsPlugin", "response"],
defaultPlugin: "LabelledUriTable"
});
// link yasqe and yasr
yasqe.on("queryResponse", function(_yasqe, response, duration) {
yasr.setResponse(response, duration);
// when response is received, enable the button
sparnatural.enablePlayBtn();
});
// listener when sparnatural updates the query
// see http://docs.sparnatural.eu/Javascript-integration.html#sparnatural-events
sparnatural.addEventListener("queryUpdated", (event) => {
// get the SPARQL query string, and pass it to yasQE
queryString = sparnatural.expandSparql(event.detail.queryString);
yasqe.setValue(queryString);
// display the JSON query on the console
console.log("Sparnatural JSON query structure:");
console.dir(event.detail.queryJson);
});
// listener when the sparnatural submit button is clicked
// see http://docs.sparnatural.eu/Javascript-integration.html#sparnatural-events
sparnatural.addEventListener("submit", (event) => {
// enable loader on button
sparnatural.disablePlayBtn() ;
// trigger the query from YasQE
yasqe.query();
});
// listener when the sparnatural reset button is clicked
// see http://docs.sparnatural.eu/Javascript-integration.html#sparnatural-events
sparnatural.addEventListener("reset", (event) => {
// empties the SPARQL query on yasQE
yasqe.setValue("");
});
// hide/show yasQE
document.getElementById('sparql-toggle').onclick = function() {
if(document.getElementById('yasqe').style.display == 'none') {
document.getElementById('yasqe').style.display = 'block';
yasqe.setValue(yasqe.getValue());
yasqe.refresh();
} else {
document.getElementById('yasqe').style.display = 'none';
}
return false;
} ;
// binds Sparnatural with the YasR plugins
bindSparnaturalWithYasrPlugins(sparnatural, yasr);
// binds Sparnatural with itself for the query execution and integration with yasqe and yasr
bindSparnaturalWithItself(sparnatural, yasqe, yasr);