Daniel Kuppitz created TINKERPOP-1609:
-----------------------------------------

             Summary: Make store() support maps
                 Key: TINKERPOP-1609
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1609
             Project: TinkerPop
          Issue Type: New Feature
          Components: process
    Affects Versions: 3.2.3
            Reporter: Daniel Kuppitz


Let me start with an example. This is the betweeness centrality algorithm from 
our recipes docs:

{noformat}
g.V().as("v").
  repeat(both().simplePath().as("v")).emit().
  filter(project("x","y","z").by(select(first, "v")).
                              by(select(last, "v")).
                              by(select(all, "v").count(local)).as("triple").
         coalesce(select("x","y").as("a").
                    select("triples").unfold().as("t").
                    select("x","y").where(eq("a")).
                    select("t"),
                  store("triples")).
         select("z").as("length").
         select("triple").select("z").where(eq("length"))).
  select(all, "v").unfold().
  groupCount().next()
{noformat}

One compute intensive part of the unrolling of previously seen triples to see 
if a shortest path between a specific pair of vertices was  already found. It 
would be smarter to store the vertex pair in a map (the key being the pair and 
value being the path length). For that reason I suggest that we make `store()` 
support maps by allowing more than one {{by()}} modulator. Furthermore we need 
the ability to select dynamic map keys, but that's another ticket. For this 
ticket focus on {{store()}} and ignore the nested {{select()}}in the following 
rewritten example:

{noformat}
g.V().as("v").
  repeat(both().simplePath().as("v")).emit().
  filter(project("x","y","z").by(select(first, "v")).
                              by(select(last, "v")).
                              by(select(all, "v").count(local)).as("triple").
         coalesce(select("m").select(select("x","y")),
                  store("m").by(select("x","y")).
                             by(select("z")).select("z")).as("length")
         select("triple").select("z").where(eq("length"))).
  select(all, "v").unfold().
  groupCount().next()
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to