Neo4j can I make relations between relations?

对着背影说爱祢 提交于 2019-12-22 13:34:25

问题


I'am using graph database (Neo4j) , and I need to make relations between relations , for example :

(user1)-[:FOLLOWED]->(user2)

I want to allow other users to like this activity (that user1 followed user2) , what's the best implementation for this ?


回答1:


Short answer:

You can't create a relation to a relation.

How to do?

You have to create an activity node in the middle of your relation:

(user1)-[:FOLLOWED]->(activity{date:..., blabla:...})-[:ACTIVITY_FOR]->(user2)

Then you'll be able to make another user LIKE this activity by creating a relation from user to activity node.

Relation names are subjectives, of course you can set your own relation names.



来源:https://stackoverflow.com/questions/35700653/neo4j-can-i-make-relations-between-relations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!