rmagen/elastic-gremlin

Lazy Vertices

eliranmoyal opened this issue · 4 comments

when asked for out/in/both and there is no need on vertex data, we should only do one step search.(search for edges)
this should be done very carefully - if there are HasSteps on the vertex we have to query the vertex type too.
Also if there are IdentitySteps / PropertySteps / this is the last step. we should not do this kind of optimizations.

"Also if there are IdentitySteps / PropertySteps / this is the last step. we should not do this kind of optimizations."
we can just have vertex's properties() load the properties lazily, (of course all vertices in the step will share the same query. Once the first vertex.properties() is triggered, all the vertices are queried.

That's sounds good.
But what you say about giving the power to the gremlin user - as he really knows what he wants.
g.V("-") - will only load verices ids
g.V().outE("-") - will only load in/out ids
g.V().out("-") - will only load inId from edges and creates a vertex from it.
I think that in our structure it will be the optimal way on searches.

*of course we will not hurt other capabilities and allow g.V().out("-","knows")

Pretty much done with this.
Only thing left is making ElasticGraph.vertices(Object... vertexIds) create lazy vertices. but for that we need lazy vertices to support lazy labels, in addition to the lazy properties.

I opened issue #51 for the remaining feature ElasticGraph.vertices(Object... vertexIds)