I am trying to do a query in Gremlin similar to the following.
SELECT * FROM profiles WHERE firstName like 'John' OR lastName like 'John'
both firstName and lastName are properties of one vertex
I am trying to do a query in Gremlin similar to the following.
SELECT * FROM profiles WHERE firstName like 'John' OR lastName like 'John'
both firstName and lastName are properties of one vertex
Copyright © 2021 Jogjafile Inc.
Assuming that
profilesis a node label (akin to a table name in SQL), and that the column names are properties on a node, the simple Gremlin form (withoutlike) would be something like:However, the Gremlin language (before release 3.6) did not have a way to express anything along the lines of
like. Some implementations offer language extensions or integration with an external index such as Elastic Search or Open Search. In those cases that is a way to achieve thelikefunctionality.Starting with TinkerPop 3.6 a new
regextext predicate has been added. So the query above can be re-written using any supported regular expression. For example, a simple case where you are not sure if the name is capitalized might be queried using:It may take a while before implementations move up to this new level, but once they do, this is one way to address queries that need vaguer searches.