Closed bshambaugh closed 6 years ago
Are you using java 8? And can you show the stack trace please.
@Test
public void test() {
this.sqlgGraph.addVertex(T.label, "Software", "name", "a");
this.sqlgGraph.addVertex(T.label, "Software", "name", "a");
this.sqlgGraph.tx().commit();
List softwares = this.sqlgGraph.traversal().V().hasLabel("Software").valueMap().toList();
Assert.assertEquals(2, softwares.size());
System.out.println(softwares.get(0));
}
result,
{name=[a]}
Thanks, this helped a lot. I looked at what you wrote and realized I was in the github comment in a way that it would not produce an error message in Eclipse.
e.g.
List software = g.traversal().V().hasLabel("Software").valueMap().toList();
Whereas, in Eclipse I had it written as something like:
List<Object> software = g.traversal().V().hasLabel("Software").valueMap().toList();
which gave "Type mismatch: cannot convert from List<Map<String,Object>> to List
Ok, I normally prefer to write it out fully, i.e.
List<Map<String,Object>> software = g.traversal().V().hasLabel("Software").valueMap().toList();
http://sql2gremlin.com/ has an example for
SELECT * FROM Categories
expressed as
g.V().hasLabel("category").valueMap()
in gremlin
I fiddled around in Java and tried to write::
List
and got an error: Type mismatch: cannot convert from List<Map<String,Object>> to List
Is there a way to reduce this valueMap to get an object, or is this not even possible due to MapValues not being implemented as a vertex property feature?