ErickJ
ErickJ
ATApache TinkerPop
Created by ErickJ on 9/15/2023 in #questions
@GremlinDSL support in the GremlinLangScriptEngine
Hi, I recently sent a pull-request into the github ArcadeDB repository to add support binding custom TraversalSources to the embedded graph bound in the script engine. ArcadeDb has modes to support both the GremlinLangScriptEngine and the GremlinGroovyScriptEngine. https://github.com/ArcadeData/arcadedb/pull/1239 I realized today that the GremlinLangScriptEngine went untested, and after trying to add a test I've come to question whether there is any support at all for DSLs in the GremlinLangScriptEngine:
Caused by: javax.script.ScriptException: org.apache.tinkerpop.gremlin.language.grammar.GremlinParserException: Failed to interpret Gremlin query: Query parsing failed at line 1, character position at 6, error message : no viable alternative at input 'g.V().person'
Caused by: javax.script.ScriptException: org.apache.tinkerpop.gremlin.language.grammar.GremlinParserException: Failed to interpret Gremlin query: Query parsing failed at line 1, character position at 6, error message : no viable alternative at input 'g.V().person'
AFAICT from the grammar, the traversalmethod are a list of static tokens, https://github.com/apache/tinkerpop/blob/c66cd566941ef7bd34d430828883f9cf79d7442f/gremlin-language/src/main/antlr4/Gremlin.g4#L178-L286 and the traversal root binding name is hardcoded to g https://github.com/apache/tinkerpop/blob/c66cd566941ef7bd34d430828883f9cf79d7442f/gremlin-language/src/main/antlr4/Gremlin.g4#L1876, and enforced in GremlinLangScriptEngine#eval This is a bit suprising to find as the DSL documentation doesn't mention these limitations, https://tinkerpop.apache.org/docs/current/reference/#gremlin-javascript-dsl and in the Groovy engine binding the TraversalSource to any token name is allowed. After reading through the code, I can understand given the current implementation why these limitations might exist, but I'm curiuos if: 1. have I missed something? 2. if not, is work planned to support DSLs in the gremlin lang script engine? 3. if not, can I help?
15 replies