O'Reilly logo

Building Web Applications with Python and Neo4j by Sumit Gupta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding relationships to models

Neomodel provides the following classes in the neomodel package for defining relationships between nodes or entities:

  • Relationship: This class is used to define a bi-directional relationship in which the "direction" of the relationship does not matter. It can be in any direction. For example, in our social data model we are using the FRIEND relationship in which direction does not matter, because if one person declares being a friend to another then vice-versa is also true.
  • RelationshipTo: It is used to define the outgoing relationship.
  • RelationshipFrom: It is used to define the incoming relationship.

All of these classes accept four parameters and expose the connect() method to establish a relationship with the given ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required