Neo4J 中的关系标签和索引 [英] Relationship Labels and Index in Neo4J

查看:31
本文介绍了Neo4J 中的关系标签和索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在新的 Neo4J 2.0.1 中标记节点,但是同样的标记对关系有用吗?如果我有一个 :TO 类型的关系,我可以在它的语句"属性上创建一个索引吗?

It's possible to label the nodes in the new Neo4J 2.0.1, but does that same labelling work on relationships? If I have a relationship of the type :TO, can I create an index on its "statement" property like that?

 CREATE INDEX ON :TO(statement)

谢谢!

推荐答案

a) 关系上不能有标签.关系只有一种类型(可以认为是一种标签).如果需要多个标签,只需创建多个不同类型的关系

a) you cannot have labels on relationships. A relationship has one type (which can be thought of kind of label). If you need multiple labels, you just create multiple relationships with different types

b) 关系上的模式索引是不可能的.图查询通常从节点而不是关系开始,因为节点是域中的事物".恕我直言,从关系开始通常是重新考虑您的图形模型的迹象.如果您仍然确信需要关系索引,则可以使用 传统索引.

b) schema indexes on relationships are not possible. A graph query typically starts at nodes and not at relationships since nodes are the "things" in your domain. Starting at a relationship is IMHO often a indication to rethink your graph model. If you're still convinced you need relationship indexing, you can go with legacy indexing.

这篇关于Neo4J 中的关系标签和索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆