Hello everyone, i'm using Neo4j Java Driver to execute some cypher queries
on a stand-alone server and i'm having some troubles dealing with
StatementResult/Record type of variables. I'll post here the code i'm
running, but it's something very common, so there's nothing special about
it:
StatementResult result = session.run( query, params );
while ( result.hasNext() ) {
Record record = result.next();
recordAsMap = record.asMap();
}
session.close();
return new JSONObject(recordAsMap);
The last row of the snippet returns a JSONObject (see first attachment
below) containing two HashMaps, vertices and edges, each containing the
desired set of nodes and relationships returning from the cypher query. The
problem is that each node (and similarly each relationship too) contains:
labels, id, properties (see second attachment). I'm only interested in
returning to frontend the properties, so i'm trying to remap the
vertices/edges so they return only an array of evertices'/edges' properties
just like it does on Neo4j Browser Table View (see third attachment). I'm
struggling to do that because vertices and edges are collections of
UnmodifiableRandomAccessList and doing any operation whatsoever on them
seems to be impossible.
-What's the best course of actions to take here?
-Am i using the wrong approach?
-Is Neo4j Java Driver the best tool or should i switch to Neo4j Rest API?
Ultimately i would just like to obtain something in the form of the last
attachment.
Thanks in advance, best regards
[image: result_example.PNG][image: node_example.PNG][image:
desired_output.PNG]
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.