cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 1: replicate users.

Querying nodes with multiple relationships

trulyani
Node Link

Hi All,

I am trying to create an application data interaction view in Neo4J. I have multiple applications (App1, App2...AppN) that interact with each other and exchange various data entities (DataEntity1, DataEntity2...DataEntityM). there could be one or more data entities between any two apps. A dataentity can be be exchanged between multiple apps (thereby creating a data flow path).
CREATE (App1:Application { name: "app1", businessunit: "unit1" })
CREATE (App2:Application { name: "app2", businessunit: "uni2" })
CREATE (App3:Application { name: "app3", businessunit: "uni3" })
CREATE (App1)-[ :SENDS_DATA { mode: "Automatic", dataentity: "dataentity1" } ]->(App3)
,(App2)-[ :SENDS_DATA { mode: "Automatic", dataentity: "dataentity2" } ]->(App3)
,(App2)-[ :SENDS_DATA { mode: "Automatic", dataentity: "dataentity3" } ]->(App3)
,(App2)-[ :SENDS_DATA { mode: "Automatic", dataentity: "dataentity4" } ]->(App3)
,(App1)-[ :SENDS_DATA { mode: "Automatic", dataentity: "dataentity2" } ]->(App3)

3X_8_4_84d3a9715a5b136ea9d4d6e5c4203ed5b1c265e2.png

now I want to see the data flow for 'dataentity2'
match path = ()-[r]->() where r.dataentity = 'dataentity2' return path
gives me this. I do get the path but along with other dataentities as well. I want only the relationship for 'dataentity2'
3X_2_f_2f1cf459f491c7050de3c0d4bf7036aace7e536d.png

how to achieve this?

1 ACCEPTED SOLUTION

dan_flavin_ente
Node Link

Go to the Neo4j Browser options (gear icon) and turn off connect result nodes to see only data you queried in the force directed graph layout. The Browser will connect items not returned by the query with the connect result nodes option on.

3X_c_6_c6ed03ac0757ce8e66d76bf7b7c63233e90c853c.png

View solution in original post

5 REPLIES 5

trulyani
Node Link

to add another question to that, some of these :SENDS_DATA relationships are uni-directional but some are bi-directional. what's the best way to handle this such that they are depicted with a uni or bi-directional arrows on the generated graph?

Try to look at your results using the "test" or "table" options, instead of the "graph" option. Do you get the one path you expected in those views? From what I have observed, the graph view renders all relationships between the nodes that resulted from your query. The other views return the exact rows from you query.

Thanks @glilienfield Yes that's what I had observed earlier. "text" and "table" tabs have only the matching relationship but the graph renders all relationships. is there any workaround?

dan_flavin_ente
Node Link

Go to the Neo4j Browser options (gear icon) and turn off connect result nodes to see only data you queried in the force directed graph layout. The Browser will connect items not returned by the query with the connect result nodes option on.

3X_c_6_c6ed03ac0757ce8e66d76bf7b7c63233e90c853c.png

fantastic! Thanks @dan.flavin_enterpris . this exactly solves my problem. much appreciated.