Hi,
I have a simple gremlin query issue.
Assume that I have vertices(label:country) each with a property: country_name:(String), and another property called GDP:(float)
I also have a huge number of vertices (label:citizen), each with edges (knows -> other citizen)
and property -> country_name(String)
I now have a simple issue.
I need to get all the countries which have a gdp within a certain range, and then i have to get all the citizens who belong to those countries, and sort by whoever has the maximum number of connections.
My problem is that the citizens are not directly connected to the country vertices by edges
So how do I tell gremlin to get citizens given an array of countries?
My code so far:
STEP ONE:get the country_names with a gdp between 12.2 and 14.5
m = []
g.V.interval("GDP",12.2,14.5).country_name.fill(m)
STEP TWO:get those citizens which belong to the above countries and sort by maximum connections.
Some thoughts I have had:
NESTED QUERY?
g.V.has("country_name",(g.V.interval("GDP",12.2,14.5).country_name))
OR
Iterate over array?
m.eachWithIndex{obj,k->
g.V.has("country_name",obj).outE()......
}
Regards,
Bhargav.