0

I want to use SDN4.0 to visualize by D3 in web application.For example,I want to use the following cypher query to get data:

   @Query("MATCH  (n:app)-[r:r1]->(m:app) RETURN n.alias,r,m.alias")
   Iterable<Map<String, Object>> getAllRelations();

But the httpServer not response the exact data I want.

[{n.alias=A, r=(227)-[r1]->(235), m.alias=B}, ....]

And I want to response r1's properties ,tried r1.* but failed.

From the http://neo4j.com/developer/guide-data-visualization/ there is possible to set resultDataContents to graph(origin as rest)

So Is it any possiblity to set this parameter in SDN4.0 or have other solutions?

Thanks if having any ideas.

K.Andy Wang
  • 401
  • 1
  • 3
  • 14

2 Answers2

0

SDN is for creating domain rich applications. As such it's not the best tool to use if all you need is a list of properties to represent a graph.

You have a couple of paths as I can see it:

  • Model your application properly with SDN. Use @NodeEntity on a class called App and create a @Relationship to another App. You can then leverage SDN's repositories to return you a rich domain model which you can then transform (e.g. using DTO's) to the front end if need be.
  • Use the java Neo4j client, OGM HTTP driver (Undocumented), or if you are happy to completely use Javascript (either from the browser or with meteor or using a NodeJS server) you can just use the Javascript driver and call the database directly.

Either way if you are using D3 I highly recommend you use JSOG to represent your model in the front end.

digx1
  • 1,100
  • 5
  • 9
  • I had little understanding of PATH1 you mentioned above. Between 'App' need to relate a rich relationship(have properties).So @Relationship not satisfied to the need.So now I want to use EmbeddedDriver to provide data for visualizing by D3.Thank you – K.Andy Wang Dec 08 '16 at 03:28
0

How do I query for relationship data in spring data neo4j 4?

Above Answer solved my question.By using Neo4jOperations.queryForObjects() under Spring data Neo4j and return path in cypher query.

Community
  • 1
  • 1
K.Andy Wang
  • 401
  • 1
  • 3
  • 14