[
https://issues.apache.org/jira/browse/TINKERPOP-1463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16164723#comment-16164723
]
Robert Dale commented on TINKERPOP-1463:
----------------------------------------
Actually, now that I understand it, I think it makes sense the way it is. It's
a filter traversal and not a value traversal if I can put it that way.
{{Remove the traverser if its object does not yield a result through the
traversal off the property value.}} now makes more sense. I think we just need
an example in the docs.
Trying to think through using {{select()}} or a value-producing traversal. It
seems to make sense when you want equals. But how would you use it for other
predicates (e.g. {{gte()}})?
Adding an example of how to use the current step implementation for
multi-valued 'objects' in a create or update traversal.
{code}
data = [['a':'marko','b':29], ['a':'jimbo','b':53]]
g.inject(data).unfold().
as('list').select('a').as('name').
select('list').select('b').as('age').
coalesce(__.V().hasLabel('person').has('name',
__.where(eq('name'))).has('age',__.where(eq('age'))),
__.addV('person').property('name',
select('name')).property('age',select('age'))
).valueMap(true)
{code}
> Improve has(propertyKey, traversal)
> -----------------------------------
>
> Key: TINKERPOP-1463
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1463
> Project: TinkerPop
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.2.5
> Reporter: Daniel Kuppitz
>
> Two issues here:
> {{.has(propertyKey, traversal)}} kinda doesn't work as expected:
> {code}
> gremlin> g = TinkerFactory.createModern().traversal()
> ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
> gremlin> g.addV(label, "software", "lang", "python")
> ==>v[12]
> gremlin> g.V().has("name","lop").values("lang").as("l").V().has("lang",
> select("l"))
> ==>v[3]
> ==>v[5]
> ==>v[12]
> gremlin> g.V().has("name","lop").values("lang").as("l").V().has("lang",
> __.where(eq("l")))
> ==>v[3]
> ==>v[5]
> {code}
> From a user perspective {{.has("lang", select("l"))}} is / would be
> self-explanatory, {{.has("lang", __.where(eq("l")))}} on the other hand is
> confusing and I don't see good use-cases for it, as you could also write:
> {code}
> g.V().has("name","lop").values("lang").as("l").V().where(values("lang").as("l"))
> {code}
> The second issue or follow-up issue is, that has-traversal should be folded
> into the {{GraphStep}}, so that the mid-traversal {{V()}} is not a full graph
> scan. Given the traversal:
> {code}
> g.V().has("name","lop").values("lang").as("l").V().has("lang", select("l"))
> {code}
> ... we would know the value of {{"l"}} at runtime. Thus it's not much
> different from
> {code}
> g.V().has("name","lop").values("lang").as("l").V().has("lang", "java")
> {code}
> The only difference is that the latter traversal knows that the {{lang}}
> value is {{java}} at compile time and the former traversal only knows it at
> runtime. In either case the value is known before it's needed for the
> mid-traversal {{V().has(...)}} lookup part.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)