On Monday, February 24, 2014 05:37:10 PM Nagore Salaberria wrote:
> The problem is that when the variables of type String get well, they need
> some quotes " " and to insert them into the query as "+ b +" does not know
> how to attach the quotes.

You'll have to put the quotes in yourself.

I suggest writing a method `quote` which quotes strings: to begin with

    static String quote(String x) {
        return "\"" + x + "\"";
    }

and then you can write

> "\n FILTER (regex(str(?g),*"+quote(g)+"*)) ." +

of course this breaks as soon as `g` might contain quotes or
backslashes, in which case I suggest

    return "\"" + FmtUtils(stringEsc(x, true) + "\"";

which is a method from ARQ that properly quotes strings for SPARQL.

Chris

-- 
"- no longer a stranger to the truth."             - The Reasoning, /Awakening/

Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)

Reply via email to