I use orientDb with thinkerpop 3 support and the data is like this:
One country has multiple states and this states has multiple cities (one exception for my example is that not every state has cities).
I would like to count the states and the cities for one specific state in one gremlin query.
ArrayList list = new ArrayList();
g.V().has("key", GERMANY_KEY)
.repeat(__.in())
.until(__.hasLabel("state"))
.as("states")
.repeat(__.in())
.until(__.hasLabel("city"))
.as("cities")
.select("states", "cities")
.fill(list);
This is what I've but after this, I don't know I can count them together.
A possible answer from this could be
Germany has 16 states and 1000 cities.
Is this possible or do I need to make two queries?
Thanks a lot.