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

查看:1951
本文介绍了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天全站免登陆