Generated DSL related

I am new to gremlin and I am struggling with a problem with custom dsl. Followed with example I can create a socialTraversalDSL to provide user to use, something like g.person("one").knows("another") it's good, but how to change the Traversal type when the given step is changed. e.g . another TwitterTraversalDSL.and user can do something like g.person("one").twitter().follows("another") when follows step is not a part of socialTraversalDSL ..How can I achieve this with java ~ looking forward to your reply
Solution:
Welcome to TinkerPop! In answer to your question, I'm afraid that the DSL annotation model isn't flexible enough to handle something like that. I believe that DSLs can inherit one another, like, you could extend TwitterTraversalDSL from SocialTraversalDSL which would extend from GraphTraversal (i've not done that myself, but i think others have had success with that). But I don't think you can have two DSLs easily know and reference one another. That might even be problematic if you were to writ...
Jump to solution
4 Replies
Solution
spmallette
spmallette2y ago
Welcome to TinkerPop! In answer to your question, I'm afraid that the DSL annotation model isn't flexible enough to handle something like that. I believe that DSLs can inherit one another, like, you could extend TwitterTraversalDSL from SocialTraversalDSL which would extend from GraphTraversal (i've not done that myself, but i think others have had success with that). But I don't think you can have two DSLs easily know and reference one another. That might even be problematic if you were to write your own extensions GraphTraversal itself without the helpful code generation the annotation processor provides.
mumutu
mumutu2y ago
Thanks for relpying~ ok It seems I have to back to my own dsl then
spmallette
spmallette2y ago
you might want to look at the DSL annotation processor code. it might take a bit of time to understand if you don't know javapoet but maybe you could modify it to do what you want to do without too much work.
mumutu
mumutu2y ago
Thanks a lot I will dive into it~
Want results from more Discord servers?
Add your server