在BatchInserter中使用Merge?

时间:2014-11-20 11:53:40

标签: neo4j

我正在使用BatchInserter来创建一些节点和关系,但是我有唯一的节点,我想在它们之间建立多个关系。

我可以使用Cypher轻松地通过以下方式使用Java Core API:

ResourceIterator<Node> existedNodes = graphDBService.findNodesByLabelAndProperty(     DynamicLabel.label( "BaseProduct" ), "code", source.getBaseProduct().getCode() ).iterator();
if ( !existedNodes.hasNext() )
{
//TO DO
} 
else {
// create relationship with the retrieved node 
} 

在Cypher中我可以轻松使用合并。

有没有办法对BatchInserter做同样的事情?

1 个答案:

答案 0 :(得分:1)

批处理插件中不可能,因为那些API不可用。

这就是我通常在内存中保存我需要查询的信息的原因。

有关groovy脚本的信息,请参阅此博文:

http://jexp.de/blog/2014/10/flexible-neo4j-batch-import-with-groovy/

相关问题