Thanks Andy. REUtil.quoteMeta() seems to do the trick.
On Tue, Jan 21, 2014 at 6:22 PM, Andy Seaborne wrote:
> On 21/01/14 16:58, Martynas Jusevičius wrote:
>>
>> Andy,
>>
>> what if I'm sending the query to a remote endpoint that does not
>> support Java style regex syntax? Do I need to use FmtU
On 21/01/14 16:58, Martynas Jusevičius wrote:
Andy,
what if I'm sending the query to a remote endpoint that does not
support Java style regex syntax? Do I need to use FmtUtils then?
FmtUtils does not have code to escape regex metacharacters.
You'll need to escape all metacharacter by string ma
On Tue, Jan 21, 2014 at 11:58 AM, Martynas Jusevičius
wrote:
> Andy,
>
> what if I'm sending the query to a remote endpoint that does not
> support Java style regex syntax? Do I need to use FmtUtils then?
>
> Looking at the example from SPARQL 1.1 STR() [1]:
>
> This query selects the set of peopl
Andy,
what if I'm sending the query to a remote endpoint that does not
support Java style regex syntax? Do I need to use FmtUtils then?
Looking at the example from SPARQL 1.1 STR() [1]:
This query selects the set of people who use their work.example
address in their foaf profile:
PREFIX foaf: <
On Tue, Jan 21, 2014 at 7:40 AM, Michael Brunnbauer wrote:
>
> I was just refering to the documentation of ParameterizedSparqlString, which
> says that "injection is done by textual substitution":
>
>
> http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/query/ParameterizedSparqlStr
Hello Andy,
I was just refering to the documentation of ParameterizedSparqlString, which
says that "injection is done by textual substitution":
http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/query/ParameterizedSparqlString.html
Thanks for pointing to FmtUtils but the functio
Michael,
Could you raise a JIRA for this with an example of where the escaping
isn't happening? Thanks.
There is code for formatting (FmtUtils) but if you have discovered a
case where it isn't being applied properly, it should be fixed.
Andy
On 21/01/14 08:43, Michael Brunnbauer wr
Hello Martynas,
uh... wait. You want to escape with regard to regex and not with regard to
SPARQL. Then I answered the wrong question :-)
Regards,
Michael Brunnbauer
On Tue, Jan 21, 2014 at 09:43:52AM +0100, Michael Brunnbauer wrote:
>
> Hello Martynas,
>
> On Tue, Jan 21, 2014 at 01:30:42AM
Works for me:
SELECT * {
VALUES ?o { "+35" "abc+35def" }
FILTER regex(?o , "\\Q+35\\E", "i")
}
and in Java you need due to both the levels of escaping (Java text,
SPARQL).
[[
Regex: Pattern exception: java.util.regex.PatternSyntaxException:
Dangling meta character '+' near index 0
Hello Martynas,
On Tue, Jan 21, 2014 at 01:30:42AM +0100, Martynas Jusevi?ius wrote:
> is there a way to build a SPARQL-specific regex string in Jena?
I do not know. com.hp.hpl.jena.query.ParameterizedSparqlString does not seem
to do the necessary escaping. This is what we do to create literals
My apologies. I replied too quickly. I just wrote this test with
Jena's command line tools. To match the string "+35", I had to use the
"\\+35" in the query:
select ?label where {
values ?label { "+35" "-35" }
filter(regex(str(?label),"\\+35"))
}
-
| label |
=
| "+35" |
On Mon, Jan 20, 2014 at 8:48 PM, Martynas Jusevičius
wrote:
> OK maybe "+35" was a bad example. But isn't "+" a special char in
> SPARQL regex? And there are more like "*", "?" etc.
> http://www.w3.org/TR/xpath-functions/#regex-syntax
Oh, good point. But if it needs to be escape with a slash, t
OK maybe "+35" was a bad example. But isn't "+" a special char in
SPARQL regex? And there are more like "*", "?" etc.
http://www.w3.org/TR/xpath-functions/#regex-syntax
If my input comes from the user, how do I escape those? I guess this
might be related:
http://www.w3.org/TR/sparql11-query/#gramm
On Mon, Jan 20, 2014 at 7:30 PM, Martynas Jusevičius
wrote:
>
> For example, Pattern.compile(Pattern.quote("+35")) produces query with
>
> FILTER regex(str(?label), "\\Q+35\\E", "i")
>
> which returns no results. So I guess I can't use the Java syntax
> directly like that. How do I escape the stri
Hey,
is there a way to build a SPARQL-specific regex string in Jena?
Now I'm using the Pattern class to implement simple regex() based
search. If the search string contains special characters, escaping is
done but the syntax does not seem to work.
For example, Pattern.compile(Pattern.quote("+35"
15 matches
Mail list logo