我是Neo4J和圖形數據庫的新手,因此我對構造關係有一些疑問。我正在爲此項目使用Neomodel。Neomodel關係
我有兩個獨立的數據模型文件(請注意,我用的,而不是作爲models.py我Neo4j的實驗與Postgres的nodes.py)
帳戶> nodes.py
class User(StructuredNode):
firstName = StringProperty()
lastName = StringProperty()
email = StringProperty()
active = BooleanProperty()
campaigns = RelationshipTo('campaigns.nodes.Campaign', 'OWNS')
系列> nodes.py
class Campaign(StructuredNode):
name = StringProperty()
campaignId = IntegerProperty()
active = BooleanProperty()
user = RelationshipFrom('accounts.nodes.User', 'OWNS')
我不知道,我有ç根據最佳實踐對關係進行了配置(我知道當前代碼是多餘的)。是否有必要在兩個節點類上都具有RelationshipTo和RelationshipFrom屬性?還是RelationshipTo從擁有者節點(用戶)到擁有的節點(Campaign)是否足夠?
還是應該有一個單獨的RelationshipTo財產活動,以用戶:
user = RelationshipTo('accounts.nodes.User', 'OWNED_BY')
我不知道這是否是連顯著的問題,但任何指導或建議將不勝感激!