douzhanbai9526 2016-03-23 15:13
浏览 125
已采纳

如果不存在关系,新主义就存在

I've only just started using neoism and enjoying it so far. I've hit a bit of a problem and wondered if it my naivety of neoism or neoism itself that's at fault.

I've got a line in my go code:

agent.Relate(relation, node.Id() , neoism.Props{})

The issue is that if I run it more than once it will duplicate the relationship. Is there a way to create only if the relationship doesn't already exist - something similar to the GetOrCreateNodeFunction.

Or will I have to write some raw cql to check if the relationship already exists before running the statement above?

Thanks in advance

  • 写回答

2条回答 默认 最新

  • dptiq46022 2016-03-24 14:52
    关注

    There is not a native function or REST endpoint for creating unique directed relationships. You might assign a unique property value to each relationship and add a unique index on the relationship property, or you might use a cypher query and the CREATE UNIQUE clause.

    http://neo4j.com/docs/stable/query-create-unique.html#_create_unique_relationships

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面