You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For what concern param value pre-processing I couldn't find a use case so far that cannot be covered by SPARQL itself.
For example:
select distinct ?city where {
BIND(iri(concat("http://dbpedia.org/resource/", ?_name)) as ?country) .
?city a <http://dbpedia.org/ontology/City> ;
<http://dbpedia.org/ontology/country> ?country .
}
There might be use cases not covered by SPARQL, and we could think to provide scripts for input preparation. However, I like the idea to keep BASIL as simple as possible, and I could not found such cases so far.
Post-processing can be done with Scripts. At the moment we support the Mustache language (that I recommend for returning HTML) and Javascript.
Documentation of this feature is not yet ready (mea culpa), I am putting few examples taken from the current catalog here, as a basis to start from:
MUSTACHE
This is the very simple example, creating a list in HTML:
Javascript:
This snippet shows how to use Javascript (implemented via Rhino):
function(){
while(this.items.hasNext()){
var i = this.items.next();
var c = (i.nationality.lastIndexOf('#') != -1) ? '#' : '/' ;
var n = i.nationality.substring(i.nationality.lastIndexOf(c) + 1);
this.print(i.label + " was born in " + n + "\n");
}
return this;
}
This is more of a new feature for the wishlist.
Say for example, if I have a simple query such as
I would like to pass just the local name in the API and concatenate it with a prefix on the fly.
Similarly it would be nice if some post processing results is possible, for example
So in this case, to convert <http://dbpedia.org/resource/Italy> to "Italy".
I was guessing may this what the scripts are for but I couldn't find the information in the documentation.
And one last minor request, will it be possible to preserve the variable names when your generate the Swagger specification?
The text was updated successfully, but these errors were encountered: