You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Daniel Kuppitz (JIRA)" <ji...@apache.org> on 2016/10/11 14:26:20 UTC

[jira] [Commented] (TINKERPOP-1496) Should a head-as("x") always be a select("x")?

    [ https://issues.apache.org/jira/browse/TINKERPOP-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15565566#comment-15565566 ] 

Daniel Kuppitz commented on TINKERPOP-1496:
-------------------------------------------

I like the idea. In the end it should be the same thing with less code. However, it only *should* be the same thing, but it's not:

{noformat}
gremlin> g.V().as("a").both().as("a").where(__.as("a").has("lang","java"))
==>v[3]
==>v[3]
==>v[3]
==>v[5]
gremlin> g.V().as("a").both().as("a").where(select("a").has("lang","java"))
java.util.ArrayList cannot be cast to org.apache.tinkerpop.gremlin.structure.Element
Type ':help' or ':h' for help.
Display stack trace? [yN]
{noformat}

The correct translation is {{select(last, "x")}}.

> Should a head-as("x") always be a select("x")?
> ----------------------------------------------
>
>                 Key: TINKERPOP-1496
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1496
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.2.2
>            Reporter: Marko A. Rodriguez
>              Labels: breaking
>
> There are two steps that treat a head of {{as("x")}} as {{select("x")}}. 
> {code}
> match(as("x").out().as("y"), ...) => match(select("x").out().as("y"), ...)
> where(as("x").has("name")) => where(select("x").has("name"))
> {code}
> I don't like how these steps are "special" in this respect and I think that it would be elegant if a head-{{as()}} has a consistent meaning for all inner traversals.
> Thus, I'm wondering if we should make it such that EVERY head {{as("x")}} gets translated to {{select("x")}}.
> {code}
> addE("knows").to(as("x").out("mother"))
> property("name", as("x").out("mother").values("name"))
> {code}
> I believe this would be backwards compatible in the sense that there really isn't a reason why an inner traversal head-{{as()}} would be used to label. Dunno -- definitely need [~dkuppitz]/etc. feedback.



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