具有 OGM 动态 @RelationshipEntity/@Relationship 值的 Neo4J

Neo4J with OGM dynamic @RelationshipEntity/@Relationship value

可以为关系节点使用动态值吗? 我想为 Neo4j 上的每个图形设置不同的关系,我认为这可以提高 Neo4j 的性能,但我想知道是否可以在 Java 上使用具有关系动态值的 OGM .

非常感谢。

要创建与动态类型的关系,您可以安装 APOC Procedures 并使用过程 apoc.create.relationship。此过程创建具有动态关系类型的关系。

例如:

with "REL_TYPE" as reltype
match (n1:Node {id:1}), (n2:Node {id:2})
call apoc.create.relationship(n1, reltype,{}, n2) yield rel
return *

将在 n1n2 之间创建关系 -[:REL_TYPE]-

使用这种方法,您可以在 Java 应用程序中将关系类型字符串作为参数传递给 Neo4j,然后调用 apoc.create.relationship.