[ 
https://issues.apache.org/jira/browse/TINKERPOP3-721?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

stephen mallette closed TINKERPOP3-721.
---------------------------------------
    Resolution: Fixed
      Assignee: stephen mallette

Solved this one I think.  I basically only {{toString()}} the id if the user 
passing a string to {{has}} - it is otherwise treated as the original objects.  
I added a test based on what this issue was originally showing as the problem 
and the old tests in place still worked under this change.

{code}
gremlin> graph = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V().has(id,lt(10))
==>v[1]
==>v[2]
==>v[3]
==>v[4]
==>v[5]
==>v[6]
gremlin> g.V().has(id,lt(3))
==>v[1]
==>v[2]
gremlin> g.V().has(id,lte(3))
==>v[1]
==>v[2]
==>v[3]
gremlin> g.V().has(id,gte(3))
==>v[3]
==>v[4]
==>v[5]
==>v[6]
gremlin> g.V().has(id,gte("3"))
==>v[3]
==>v[4]
==>v[5]
==>v[6]
gremlin> g.V().has(id,lt("10"))
==>v[1]
{code}

> Reduce confusion between when IDs are treated as strings and not.
> -----------------------------------------------------------------
>
>                 Key: TINKERPOP3-721
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-721
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>            Reporter: Kelvin R. Lawrence
>            Assignee: stephen mallette
>            Priority: Minor
>             Fix For: 3.0.0.GA
>
>
> Opening this per request from Marko on the Gremlin-Users list.
> The normalization of IDs to strings in certain cases causes unexpected (or at 
> least inconsistent) behaviour patterns for users of Gremlin and at least in 
> my case caused confusion.
> Here is a specific example:
> If I code this, id is treated as a string (not what I wanted)
> gremlin> g.V().has(id,lt(10))
> ==>v[1]
> So I ended up trying this and it works as expected.
> gremlin> g.V().as('x').id.is(lt(10)).select('x')
> ==>v[1]
> ==>v[2]
> ==>v[3]
> ==>v[4]
> ==>v[5]
> ==>v[6]
> ==>v[7]
> ==>v[8]
> ==>v[9]
> Marko pointed out that I could have coded::
> g.V.where(id().is(lt(10)))
> Which indeed does work as id() returns a long integer.
> As a side note I have the following base configuration set:
> conf = new BaseConfiguration()
> conf.setProperty("gremlin.tinkergraph.vertexIdManager","LONG")
> graph = TinkerGraph.open(conf)



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

Reply via email to