Improve finding entity and field nodes
Here are changes that works for my gremlin implementation again our own database. Please help me review it. Thank you.
Thanks for the PR Kung. I'll take a look.
Would it be possible for you to provide the schema you're working with along with some queries?
There are there tables involve in this query: mdmcustomer, mdmticket and mdmopportunity.
the relationship is defined as: mdmcustomer.mdmcompanycode <= mdmticket.mdmcompanycode mdmcustomer.mdmcompanycode <= mdmopportunity.mdmcompanycode
here is the SQL query: select c.mdmcompanycode, count(i.mdmcompanycode), count(o.mdmcompanycode) from mdmcustomer as c join mdmticket as i on c.mdmcompanycode = i.mdmcompanycode join mdmopportunity as o on o.mdmcompanycode = c.mdmcompanycode group by c.mdmcompanycode
Although I did see where I can see the gremlin generated, but I would imaging it should be something like this:
g.V().hasLabel("mdmcustomer").as("customers") .match( __.as("c").both("has Opportunity").count().as("opportunities"), __.as("c").both("has_ticket").count().as("tickets")) .select("customers", "opportunities", "tickets")
But after SQL had been parsed, and creating traversal tree, it traverses from mdmticket to mdmopportunity.