1

enter image description here

I used django_neomodel to connect the Neo4j graph database. The graph data in Neo4j database is above which is the relationships between genes.

This is my model for data.

class Genes(StructuredNode):
    id = StringProperty()
    name = StringProperty()
    source = Relationship('Genes', 'Interaction')
    target = Relationship('Genes', 'Interaction')

When I run len(Genes.nodes) in python shell, it throws an error:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "G:\software\anaconda\envs\flybase\lib\site-packages\neomodel\util.py", line 344, in __get__
    return self.getter(type)
  File "G:\software\anaconda\envs\flybase\lib\site-packages\neomodel\core.py", line 266, in nodes
    return NodeSet(cls)
  File "G:\software\anaconda\envs\flybase\lib\site-packages\neomodel\match.py", line 581, in __init__
    install_traversals(self.source_class, self)
  File "G:\software\anaconda\envs\flybase\lib\site-packages\neomodel\match.py", line 172, in install_traversals
    raise ValueError("Can't install traversal '{0}' exists on NodeSet".format(key))
ValueError: Can't install traversal 'source' exists on NodeSet

Anybody knows why?

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
qi zuo
  • 26
  • 2

1 Answers1

0

source is just a reserved attribute of a NodeSet in neomodel.

Use a different name for your Relationship instance.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195