I am calling JanusGraph remote, which returns ReferenceVertex by default. In order to retrieve properties as well, I use valueMap(), which works well for simple queries.
However, in my use case I need to build a join, which works well based on ReferenceVertex as follows:
// select t1.table2_ID, t2.table2_ID from table1 as t1 inner join table2 as t2 on t1.table2_ID = t2.table2_ID
GraphTraversal<?, ?> t1 = __.start().as("table1").out("relatesTo").hasLabel("table2").as("table2");
GraphTraversal<?, ?> t2 = g.V().hasLabel("table1").match(t1).select("table1", "table2");
List<?> l = t2.toList();
When adding valueMap to the traversal to retrieve the properties it fails. I want to include specific properties as follows:
// select t1.column1, t2.column2 from table1 as t1 inner join table2 as t2 on p.table2_ID = c.table2_ID
GraphTraversal<?, ?> t1 = __.start().as("table1").out("relatesTo").hasLabel("table2").valueMap(true, "column2").as("table2");
GraphTraversal<?, ?> t2 = g.V().hasLabel("table1").valueMap(true, "column1").match(t1).select("table1", "table2");
List<?> l = t2.toList();
-> java.util.HashMap cannot be cast to org.apache.tinkerpop.gremlin.structure.Element
Did I build the wrong traversal, or is this a limitation / bug in Tinkerpop?
Thank you