[
https://issues.apache.org/jira/browse/TINKERPOP-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
stephen mallette updated TINKERPOP-1048:
----------------------------------------
Assignee: stephen mallette
Component/s: (was: process)
tinkergraph
TinkerGraph is a little strange. There are tests that enforce finding
{{Number}} id values as {{String}} for:
{code}
gremlin> graph.vertices("12")
gremlin> g.V("12")
{code}
but TinkerGraph has to be configured to support them. By default, TinkerGraph
works in the way that it always has, where the type of the id must match what
is stored in the database. That's why the above two don't work, as they are
long. In fact, you would find that anything other than passing a {{Long}}
would not behave nicely under default operations:
{code}
gremlin> g.addV().id()
==>0
gremlin> g.V(0)
gremlin> g.V(0L)
==>v[0]
gremlin> graph.vertices(0)
gremlin> graph.vertices(0L)
==>v[0]
{code}
To enable the behavior that allows this to work, an {{IdManager}} must be
configured:
{code}
gremlin> conf = new BaseConfiguration()
==>org.apache.commons.configuration.BaseConfiguration@4d9d1b69
gremlin> conf.setProperty("gremlin.tinkergraph.vertexIdManager", "LONG")
==>null
gremlin>
conf.setProperty("gremlin.graph","org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph")
==>null
gremlin> graph = GraphFactory.open(conf)
==>tinkergraph[vertices:0 edges:0]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> g.addV()
==>v[0]
gremlin> g.V(0L)
==>v[0]
gremlin> g.V(0)
==>v[0]
gremlin> g.V("0")
==>v[0]
gremlin> graph.vertices(0L)
==>v[0]
gremlin> graph.vertices(0)
==>v[0]
gremlin> graph.vertices("0")
==>v[0]
{code}
Of course, that makes {{hasId()}} weird because its behavior is then difference
under the default TinkerGraph configuration. I guess TinkerGraph should change
in this regard, but I feel like i went down this path before into ruin. We'll
see.....
> Vertex lookups by id are inconsistent
> -------------------------------------
>
> Key: TINKERPOP-1048
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1048
> Project: TinkerPop
> Issue Type: Bug
> Components: tinkergraph
> Affects Versions: 3.1.1-incubating
> Reporter: Daniel Kuppitz
> Assignee: stephen mallette
> Fix For: 3.1.1-incubating
>
>
> {{graph.vertices(id)}}, {{g.V(id)}} and {{g.V().hasId(id)}} should all return
> the same result. However, currently only the latter respects the
> {{toString()}} representation of ids.
> {noformat}
> gremlin> g.addV().id()
> ==>12
> gremlin> graph.vertices("12")
> gremlin> g.V("12")
> gremlin> g.V().hasId("12")
> ==>v[12]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)