Closed tlorenzetti closed 8 years ago
I identified the error in preprocessResourceTokenForCompletion
(preproceutils.js
line 28-34)
for (var prefix in queryPrefixes) {
if (token.string.indexOf(prefix) == 0) {
token.autocompletionString = queryPrefixes[prefix];
token.autocompletionString += token.string.substring(prefix.length + 1);
break;
}
}
To build autocompletionString it just takes the first prefix encountered in queryPrefixes. To fix this, I think it's enough to change
if (token.string.indexOf(prefix) == 0) {
to
if (token.string.indexOf(prefix + ":") == 0) {
thanks for the thorough bug report! It should be fixed now (and released as v2.11.2)
Let's suppose I have this prefixes declarated in my query
when I try to autocomplete properties starting with
mypref:
theautocompletionString
that I obtain afterpreProcessToken
ofproperties
autocompleter ishttp://myfirstprefix#ref:
It seems thatpreProcessToken
identifies the wrong prefix and replaces justmy
(inmypref:
) with its namespace instead of replacing the entire prefix.I noticed this when I declarated both
rdf
andrdfs
and I tried to autocompleterdfs:
: The request to lov API was http://lov.okfn.org/dataset/lov/api/v2/autocomplete/terms?q=http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3A&page=1&type=property where, as you can see, it uses the rdf namespace (instead of rdfs).