I am currently usring Spring and neo4j. One mission is to display the graph using linkurious. However, how can I tell Spring through spring-data-neo4j the labels of the nodes? I need the labels to color the graph in linkurious. If using findAll()
defined in the graph repository, only node properties will be returned?
Any suggestion?
UPDATE
I tried to use @QueryResult
, but there's something wrong with the respond. To be more specific:
I define
@QueryResult
public class NodeWithLabel {
GLNode glNode;
ArrayList<String> labels;
}
then in the repository, I have
@Query("MATCH (n:GLNode) RETURN n AS glNode, labels(n) as labels")
Collection<NodeWithLabel> getAllNodesWithLabel();
Finally, I will get a result with ArrayList<E>
, so the spring mvc will respond empty like [{},{},{},{}]
. Normally, such as the embedded findAll()
function, a LinkedHashSet<E>
should be returned, in this case, the spring mvc can send back a json respond.