Closed bangsun closed 5 years ago
Hello @bangsun,
Because native Gremlin currently has no functionality for type conversion
cypherToInteger
is implemented as part of Cypher Extensions.
You need to install Cypher for Gremlin plugin to your target Gremlin Server (note that cloud implementations like AWS Neptune or Cosmos DB does not allow to install plugins).
If the plugin is installed, translation on the server will support custom functions automatically.
If you are using translation on the client side, you will need explicitly mention that server has Cypher Extensions installed:
Translator<String, GroovyPredicate> translator = Translator.builder()
.gremlinGroovy()
.enableCypherExtensions()
.build(TranslatorFlavor.gremlinServer());
Native support of type predicates might be implemented in TinkerPop 3.5 release.
As a side note. Do you need to explicitly convert p.age
to an integer? Because query that you've provided as an example should work without it if age
has numeric type. Or this is just for example?
Please let me know if you have any other questions, or close this issue.
Thank you @dwitry , your reply solved my problem. By the way, toInt(p.age) here is just for example. These custom functions are used in practise in many of our scenarios. cypher for gremlin is really appreciate in these scenarios.
cypher: MATCH (p:Person) WHERE toInt(p.age) > 25 RETURN p.name output: Exception in thread "main" org.opencypher.gremlin.translation.exception.SyntaxException:Custom functions and predicates are not supported: cypherToInteger have the plan to support toInt etc function ?