ClassCastException in Tinkerpop on edge retrieval

1,126 views
Skip to first unread message

Eugene Dzhurinsky

unread,
Jul 11, 2015, 9:43:24 PM7/11/15
to gremli...@googlegroups.com
Hello! I have some weird problem with most recent release of TinkerPop  3.0.0.M9-incubating

The following query

gr.traversal().V().has("id", leftId.toString).outV().has("id", rightId).inE(edgeKind.kind).tryNext()

fails with the exception

java.lang.ClassCastException: com.thinkaurelius.titan.graphdb.vertices.CacheVertex cannot be cast to org.apache.tinkerpop.gremlin.structure.Edge
    at org
.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeVertexStep.flatMap(EdgeVertexStep.java:47)
    at org
.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep.processNextStart(FlatMapStep.java:47)
    at org
.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:131)
    at org
.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:54)
    at org
.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep.processNextStart(FilterStep.java:37)
    at org
.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:131)
    at org
.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:54)
    at org
.apache.tinkerpop.gremlin.process.traversal.step.map.FlatMapStep.processNextStart(FlatMapStep.java:46)
    at com
.thinkaurelius.titan.graphdb.tinkerpop.optimize.TitanVertexStep.processNextStart(TitanVertexStep.java:87)
    at org
.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:131)
    at org
.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:117)
    at org
.apache.tinkerpop.gremlin.process.traversal.Traversal.tryNext(Traversal.java:66)


The traversal produced by this code looks like:

[GraphStep([],vertex), HasStep([id.eq(5544989c-6baf-47d9-b028-58f4cf493dae)]), EdgeVertexStep(OUT), HasStep([id.eq(db4aa152-c974-42f4-8fcf-b1218baad3b3)]), VertexStep(IN,[human-organization-relation],edge)]

The type of the expression is correct.

What am I missing there?

Thanks!

Daniel Kuppitz

unread,
Jul 11, 2015, 10:01:46 PM7/11/15
to gremli...@googlegroups.com
The traversal is invalid. Replace outV() with out() and it should work.

Cheers,
Daniel

From: Eugene Dzhurinsky
Sent: ‎7/‎12/‎2015 3:43
To: gremli...@googlegroups.com
Subject: [TinkerPop] ClassCastException in Tinkerpop on edge retrieval

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/d1e5ba44-4c05-4d4b-a0e4-c1762caa8e14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eugene Dzhurinsky

unread,
Jul 11, 2015, 10:13:01 PM7/11/15
to gremli...@googlegroups.com
Okay, I'll try that - but the type of the resulting expression is correct.

I need to find a vertex with certain ID1 and then find an edged from this vertex to another vertex with different ID2, so I assume that I need to

- find a vertex with ID1
- get the "out" vertex with ID2
- find the IN edge for vertex ID2 with the given label

So there should be no difference between out and outV in this case?

Daniel Kuppitz

unread,
Jul 12, 2015, 9:42:54 AM7/12/15
to gremli...@googlegroups.com
What do you mean by "the type of the resulting expression is correct"? An EdgeVertex step may not follow a VertexStep.

- find a vertex with ID1
- get the "out" vertex with ID2
- find the IN edge for vertex ID2 with the given label

That's:

g.V(ID1).outE(givenLabel).where(inV().has(ID2))

Cheers,
Daniel

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.

Eugene Dzhurinsky

unread,
Jul 12, 2015, 10:42:07 AM7/12/15
to gremli...@googlegroups.com
On Sun, Jul 12, 2015 at 03:42:51PM +0200, Daniel Kuppitz wrote:
> What do you mean by "the type of the resulting expression is correct"? An
> EdgeVertex step may not follow a VertexStep.

So there's no compile-time errors or runtime checks for the query correctness?

--
Eugene N Dzhurinsky
signature.asc
Reply all
Reply to author
Forward
0 new messages