Case-insensitive matching with "contains" or regex, or anything


#1

Hi,

Is there any way I can inquire attribute with case-insensitive matching?

I am accessing Grakn REST API over Node SDK.

I thought I could do it with regex, but
match $illness isa illness has name $name; $name val /.*Total.*/; get $name;
It seems that I cannot find a way to specify case-insensitive matching option…

Thank you.


#2

I have tested it. Queries with regex are case sensitive even through the nodejs driver. That makes sense as the driver is only forwarding your request to the DB. It behave in exactly the same manner as it would from the visualiser.

In my data I know to have an email that has the value: member@test.com

if I query for:

match $e isa email, has value $val; $val val /.*member.*/;get;

It is returned, but if I query for /.*Member.*/ it is not. this is the expected behaviour.


#3

Thank you, Samuel.

So, is it not possible to run case insensitive queries on attributes of type string in any way? (Rest API, Java, console, etc.)

Just want to clarify this.


#4

you could use the i flag for your regex that would make it case insensitive:

/.*Total.*/i

#5

Are you sure? Because it didn’t work on REPL console or web visualizer, though.

Or it works with REST API or Java?
It would be great if it works somehow.


#6

I am sure for the regex :wink: but yeah, GRAKN.AI seems not to accept flags after the / maybe that would do a nice issue on github for an upcoming release.

Sam


#7

Thank you, Sam. :slight_smile:

For the case I am working on, I will just have another attribute for text matching strings in lower case for matching purposes. It would be very cumbersome to have a matching searchable pair for every string attribute, so it would be great if it works in future.

I will report it on GitHub.