Querying nodes with multiple relationships

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)

image

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'
image

how to achieve this?

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?

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.

image

1 Like

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