I am new to Neo4J and graph databases in general and so I have some questions about structuring relationships. I am using Neomodel for this project.
I have two separate data model files (Note that I am using nodes.py instead of models.py as I experiment with Neo4J vs. Postgres)
accounts > nodes.py
class User(StructuredNode):
firstName = StringProperty()
lastName = StringProperty()
email = StringProperty()
active = BooleanProperty()
campaigns = RelationshipTo('campaigns.nodes.Campaign', 'OWNS')
campaigns > nodes.py
class Campaign(StructuredNode):
name = StringProperty()
campaignId = IntegerProperty()
active = BooleanProperty()
user = RelationshipFrom('accounts.nodes.User', 'OWNS')
I am not sure that I have configured the relationships according to best practice (I am aware that the current code is redundant.) Is it necessary to have RelationshipTo and RelationshipFrom properties on both node classes? Or is RelationshipTo from the owner node (User) to the owned node (Campaign) sufficient?
Or should there be a separate RelationshipTo property from Campaign to User:
user = RelationshipTo('accounts.nodes.User', 'OWNED_BY')
I'm not sure if this is even a significant issue, but any guidance or tips would be greatly appreciated!