如何在Neo4j和APOC v3.4.0.1中使用“ apoc.map.fromPairs”?

时间:2018-10-13 19:04:52

标签: neo4j neo4j-apoc

我是neo4j的新手,我试图通过将XML文件加载到地图中来尝试使用它。

我尝试了以下在APOC User Guide中发布的示例:

call apoc.load.xml("https://raw.githubusercontent.com/neo4j-contrib/neo4j-apoc-procedures/3.4/src/test/resources/xml/books.xml") yield value as catalog
UNWIND catalog._children as book
WITH book.id as id, [attr IN book._children WHERE attr._type IN ['author','title'] | [attr._type, attr._text]] as pairs
CALL apoc.map.fromPairs(pairs) yield value
RETURN id, value

但是出现以下错误:

Neo.ClientError.Procedure.ProcedureNotFound: There is no procedure with the name `apoc.map.fromPairs` registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.

我注意到“ apoc.map.fromPairs”不是“ apoc-3.4.0.1”下的过程,因此我尝试了以下操作。所以我试图将语句转换为:

call apoc.load.xml("https://raw.githubusercontent.com/neo4j-contrib/neo4j-apoc-procedures/3.4/src/test/resources/xml/books.xml") yield value as catalog
UNWIND catalog._children as book
WITH book.id as id, [attr IN book._children WHERE attr._type IN ['author','title'] | [attr._type, attr._text]] as pairs
RETURN apoc.map.fromPairs(pairs)

哪个没有用。我收到以下错误:

Neo.ClientError.Statement.SyntaxError: Unknown function 'apoc.map.fromPairs' (line 4, column 8 (offset: 320))
"RETURN apoc.map.fromPairs(pairs)"

关于如何解决此问题的任何想法?

谢谢

0 个答案:

没有答案