cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Retrieving properties from distant nodes

Guess this is easy - when you know how to do it - but haven't found examples in the documentation yet. 

 

I have a graph structure similar to below. Main point of query is at the patient level and queries will be starting with only a single node property (patient.name={'PatientA'})

For the nodes directly related to the starting node, Patient, I was using the following to retrieve properties: 

 

MATCH (patient {name='PatientA'})-[CURRENT_DIAGNOSIS]>-(d:Diagnosis)

RETURN

d.name AS Current Diagnosis

d.date AS Date of Diagnosis

 

But what is the best way to retrieve properties of distant nodes? 

1.What is the name of the doctor that gave PatientA their current diagnosis?

2. What drugs can be used to treat the symptoms of the current diagnosis of PatientA (given only the patient's name)?

 

Also

1. Does direction of relationship make a difference to efficiency of retrieval?

2. Should graph database structure be different if the end use will be retrieve to external app rather than just using Cypher within Neo4j (ie to make it operate faster for graphql queries)?

Thanks. New to this, so greatly appreciate any tips. 

graph.jpg

0 REPLIES 0