Optimized executable query. How is it optimized ? Instead of simply searching through all vertices linked to class vertex (which always exist) through Object.classes edge, this one tries to find the vertex linked to the smallest solution space. How ? As an example, suppose one want to find, using our test beans, elements matching that query :
AND Posts.note ==? 4.0 Posts.author.login ==? "user login" Object.classes contains Post.class
This class will start by extracting query roots (vertices to which solutions of this query MUST be linked) by calling {@link #getPossibleRootsOf(VertexTest)}In this example, this method call will return
4.0:long => { Property[note] } "user login":string => { Property[author], Property[login] } Post:class => { Property[class] }
One question remain : from these three vertices, which one will be linked (through the given property path) to the smallest number of vertices ? To answer this question, the {@link #findBestRootIn(Map)} method creates a {@link VertexSet} object which can back-navigate the edges representing these propertiesand directly give us the best query root.
@author ndx