[
https://issues.apache.org/jira/browse/TINKERPOP3-762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14651909#comment-14651909
]
Matt Frantz commented on TINKERPOP3-762:
----------------------------------------
What about a structure that could be used as a source, and that would allow the
intent to be more obvious, e.g. pairwise vs. cross-product, etc. using logic
like {{match}}?
It seems preferable to allow initiation of this from a source, so that the
strategy can decide which order to execute the two or more source traversals.
Here is a "join" reasoning traversal, creating edges based on property matching:
{noformat}
g.match(
__.V().hasLabel('company').as('c'),
__.V().hasLabel('person').as('p'),
__.as('c').values('name').as('cname'),
__.as('p').values('companyName').as('pname'))
.where('cname', eq('pname')
.dedup('c', 'p')
.select('c', 'p')
.addOutE('p', 'worksFor', 'c')
{noformat}
Here is a "cross-product" traversal, materializing the NxN space, except the
diagonal:
{noformat}
g.match(
__.V().hasLabel('person').as('a'),
__.V().hasLabel('person').as('b'))
.where('a', neq('b'))
.select('a', 'b').as('pair')
.addOutE('a', 'relatesTo', 'b')
.select('pair').addOutE('b', 'relatesTo', 'a')
{noformat}
> Allow mid-traversal V() (and E())
> ---------------------------------
>
> Key: TINKERPOP3-762
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-762
> Project: TinkerPop 3
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.0.0-incubating
> Reporter: Daniel Kuppitz
> Assignee: Marko A. Rodriguez
>
> We should allow mid-traversal {{V()}} and {{E()}}. It shouldn't be a
> technical problem, since we always know the traversal source, thus it's just
> a simple {{flatMap}}. Vendors could then implement mid-traversal global index
> lookups.
> *Example*:
> {code}
> g.V().hasLabel("company").has("name", "DataStax").in("worksFor").as("dse").
> V().hasLabel("company").has("name", "Aurelius").in("worksFor").as("ae").
> addOutE("dse", "knows", "ae", "since", "02/2015")
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)