cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving properties from distant nodes

subs
Node

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
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.