ErickJ
ErickJ
ATApache TinkerPop
Created by ErickJ on 9/15/2023 in #questions
@GremlinDSL support in the GremlinLangScriptEngine
I can't speak for ArcadeDB, I had submitted a pull request which we merged but then I rolled back once I realized only the groovy interpreter worked. The arcadedb usage of the script engines are an orthogonal configuration. I'm speaking more w/ the lead on the arcadedb project on the PR thread, but I think in the end the underlying gremlin script engine is expected to have feature parity, and be mostly transparent to the user. On my own use case, the desire is to simplify the client endpoint, so that read-only queries can be written in the DSL and get executed directly on the server against the embedded graph, where the DSL's TraversalSource is bound to g . This eliminates quite a bit of complexity IMO, since the DSL & the traversal definition stays only on the server. In my own use case there is no HTTP server, but a streaming GRPC protocol between. Since, as you said earlier, the DSL is just mapping to tinkerpop traversal methods my expectation was that this would just work, but I had only ever tested previously on the groovy script engine. If instead it was possible to bytecode compile the DSL query string directly in Java somehow, that would also suffice, although it's still not as clean as just sending the DSL query into the graph.
15 replies
ATApache TinkerPop
Created by ErickJ on 9/15/2023 in #questions
@GremlinDSL support in the GremlinLangScriptEngine
Ok, thanks for your time here
15 replies
ATApache TinkerPop
Created by ErickJ on 9/15/2023 in #questions
@GremlinDSL support in the GremlinLangScriptEngine
@spmallette one last follow up on this. It sounds as though from your answer there is no expectation of feature parity between the script engine implementations. Beyond lambda "support" (/ arbitrary code execution) in the groovy implementation, and this issue here, is there a list of these feature differences documented anywhere?
15 replies
ATApache TinkerPop
Created by ErickJ on 9/15/2023 in #questions
@GremlinDSL support in the GremlinLangScriptEngine
>. it's important to keep in mind though that any solutions considered can't be isolated to java. ahh, ok, yes I forgot that certainly. thanks for the context
15 replies
ATApache TinkerPop
Created by ErickJ on 9/15/2023 in #questions
@GremlinDSL support in the GremlinLangScriptEngine
What if the @GremlinDsl annotation processor also produced a g4 grammar for the the DSL, then also producing new TraversalMethodVisitor (& TraversalSourceSpawnMethodVisitor... etc) implementations which implemented the DSL => traversal translation as it is done now in those classes, but for the new DSL. Then extending the g4 traversalMethod rule (traversalSourceSpawn rule, et.al) with something like:
traversalMethod
...
|dslTraveralMethod

dslTraversalMethod
| <some pattern matching valid method names> LPAREN <some var args matching rule> RPAREN
traversalMethod
...
|dslTraveralMethod

dslTraversalMethod
| <some pattern matching valid method names> LPAREN <some var args matching rule> RPAREN
this would let the method match rule bottom out at something that could match a DslRule. The dsl annotation processor would the be responsible for creating also creating DslTraversalMethodVisitor.java DslTraversalSourceMethodVisitor.java, etc... which could then be provided to the GremlinAntlrToJava.java . Then the tricky bit is how to provide that... IMO the cleanest way would be via the TraversalSource itself (and in doing so would parameterize the GremlinAntlrToJava and all visitor classes to <T extends TraversalSource>, so that the TraversalSource is fully responsible for describing itself and it's parsing. However I can certainly appreciate that I am completely naive to the wider architectural design concerns there ... certainly there's lots of details to work out, even if this were in the ballpark.
15 replies
ATApache TinkerPop
Created by ErickJ on 9/15/2023 in #questions
@GremlinDSL support in the GremlinLangScriptEngine
Thanks for the quick reply Stephen. Just some follow up comments/questions below
It only processes Gremlin, which I tend to think is a good thing compared to GremlinGroovyScriptEngine
Precisely why I'd like to support use of the GLSE 🙂
I'll assume this is about sending scripts in which case you'd use your DSL to produce bytecode, then pass that traversal to the translator (https://github.com/apache/tinkerpop/blob/master/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/translator.js) which would then produce a pure Gremlin script to submit with the client, send over HTTP, etc..
This integration is at an engine level inside of Arcade DB, in order to support DSLs without requiring the use of the HTTP server, and without requiring a client compilation step, so this is a pure Java integration. Is there a way to produce Traversal bytecode from strings via a pure Java interface? I looked into this a few years ago and believe I found otherwise.
i'm not sure it would be good for DSLs to be implemented that way as it requires knowledge of antlr,
Completely agree with you. My thought here is currently someting like....
15 replies