zendorphins
ATApache TinkerPop
•Created by zendorphins on 7/20/2023 in #questions
Modify traversal from outside the function that builds the traversal (Java)
Hi peeps, more of an OOP oriented question this time around. I'll start off by explaining what I'm trying to do first.
In my app I have a bunch of tables that can have different types of filters applied to them. To make my life easier on the backend I've made an abstract Filter class which is extended by all the different types of filters, and the model mapper knows which subclass I want from a field sent in the request.
A good way to apply the filtering to the traversal would be to have a dsl step that takes the list of filters, checks which instanceof each filter is and does it's stuff accordingly. I wanted to know if there would be any way to keep the logic in the filter classes, overriding the method in each subclass.
Perhaps something like generating the steps in the filter and adding them to the admin traversal in the dsl, I'm not sure.
9 replies
ATApache TinkerPop
•Created by zendorphins on 4/3/2023 in #questions
Translating bytecode into JupyterLabs compatible script.
I've found that the gremlin syntax in jupyter is different from every other language, including python. For now i've resorted to copying the java PythonTranslator into a new class and modifying the code to suit the differences. Does a better way exist?
18 replies
ATApache TinkerPop
•Created by zendorphins on 3/20/2023 in #questions
Has anyone else encountered "NoSuchElementException" when calling getLeafTrees() on a tree object
Did a little bit of debugging and it seems that the issue has to do with a cast to Tree before calling the isLeaf() method inside getLeafTrees(). As far as my testing goes it seems to happen when a child of the root is a leaf. Here's an example dataset and the tree query:
Data:
Query:
g.V().hasLabel("Dev").hasLabel("root").emit().until(out().count().is(0)).repeat(out()).tree().by(elementMap()).next()
The edge lables are inconsequential, i just modified a binary tree. The elementMap inside the by is also there for debug purposes.20 replies