I'm trying to test if a string is contained in another in a case-insensitive way. The SPARQL expression
REGEX ( ?str, ?tok, "iq" )
should do that. The q
flag is needed in addition to the i
flag because ?tok
may have regex special characters such as [
or \
. The REGEX should behave just like XQuery fn:matches
function. However, including the q
flag simply makes the expression return always false.
[update: it does not return false, it does not return a value at all]
Is this an issue in the GraphDB implementation I'm using or have I misinterpreted the standard? Has anyone observed this oddity in other SPARQL implementations?
I can work around this specific case by replacing it with
CONTAINS ( LCASE(?str), LCASE(?tok) )
but other scenarios which may need flags x
, s
and m
do not seem to have an easy replacement. [update: the other flags all work correctly, only q
is broken]
[note: the workaround with lcase()
is suboptimal; regex
should be more efficient.]
How do other triple stores behave in this respect?