0

Hi I'm new to neo4j and cypher. I've built my database such that there are multiple depths in the graph you can start at. In my example the graph is a tree the root node is an index and nodes at level 4 are indices. I'm using py2neo to develop the graph and I use the get_or_create_indexed_node method in accordance with: py2neo documentation

patient_node = graph_db.get_or_create_indexed_node('patients', 'name',
patients[patient_id])

but when I run my cypher query such that I land on a index node I can only get the id. For example when I do this:

start n=node:rootnode(name='root'), p=node:patients('name:*')
match n-[:chrm]-()-[:pos]-()-[:patient]-p-[:variant]->vars 
where (has(vars.mutations))  return p.name"

I get error saying: The property 'name' does not exist on Node[84361]

what am i doing wrong?

user2343996
  • 153
  • 4

1 Answers1

1

You haven't mentioned that you are adding any properties to the nodes returned from get_or_create_indexed_node. The function is get_or_create_indexed_node(index, key, value, properties=None), so the values you provided are only the index name, key and value.

You need to create the node like this:

node = graph_db.get_or_create_indexed_node('patients', 
                                           'name', patients[patient_id], 
                                           patient_properties)
Thomas Fenzl
  • 4,342
  • 1
  • 17
  • 25