Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
neo4j创建多个节点json_Json_Neo4j - Fatal编程技术网

neo4j创建多个节点json

neo4j创建多个节点json,json,neo4j,Json,Neo4j,请告诉我哪里出了问题 我正在使用neo4j存储我的路由器接口和链接信息。将在2个接口之间创建链接。 我已经成功创建了节点和接口,但在创建链接时发现了问题 这是我用来创建链接的查询 MATCH (I:Interface), (I2:Interface) FOREACH(p in FILTER(z in {props} WHERE z.OrigIPAddress = I.IfIPAddress or z.TermIPAddress = I.IfIPAddress) | MERGE (I {IfI

请告诉我哪里出了问题 我正在使用neo4j存储我的路由器接口和链接信息。将在2个接口之间创建链接。 我已经成功创建了节点和接口,但在创建链接时发现了问题

这是我用来创建链接的查询

MATCH (I:Interface), (I2:Interface) 
FOREACH(p in FILTER(z in {props} WHERE z.OrigIPAddress = I.IfIPAddress or z.TermIPAddress = I.IfIPAddress) | 
MERGE (I {IfIPAddress:p.OrigIPAddress})-[r:link]->(I2 {IfIPAddress:p.TermIPAddress}) 
ON CREATE SET r = p 
ON MATCH SET r = p) 
我有一个名为props的映射数组,我将它作为参数传入json,其中包含链接的属性,即OrigIPAddress(原始接口IP)、TermIPAddress(终止接口IP)。 在foreach中,我首先过滤所有已经存在源或目标接口的链接。现在,在完成这项工作后,我正在用道具创建链接

当我运行此程序时,它会正常运行,但不会创建任何链接。存在源接口和目标接口

编辑1: 我修改了查询,当我运行此查询时

MATCH (I:Interface), (I2:Interface) 
FOREACH(p in FILTER(z in {props} WHERE z.OrigIPAddress = I.IfIPAddress and z.TermIPAddress = I2.IfIPAddress) | 
MERGE (I {IfIPAddress:p.OrigIPAddress})-[r:link]->(I {IfIPAddress:p.TermIPAddress}) 
ON CREATE SET r = p 
ON MATCH SET r = p)
我没有从neo4j得到ant响应,在neo4j web控制台中,我可以看到这个会议 “Neo4j已断开,请检查您的插座…”

这是日志 2014年4月9日上午11:06:46 org.neo4j.server.logging.Logger日志 警告:您正在使用不受支持的Java运行时。请使用Oracle(R)Java(TM)运行时环境7

SEVERE: The response of the WebApplicationException cannot be utilized as the response is already committed. Re-throwing to the HTTP container
javax.ws.rs.WebApplicationException: javax.ws.rs.WebApplicationException: org.eclipse.jetty.io.EofException
    at org.neo4j.server.rest.repr.OutputFormat$1.write(OutputFormat.java:174)
    at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:71)
    at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:57)
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1506)
    at org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1477)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:211)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
    at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:445)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
    at java.lang.Thread.run(Thread.java:744)
Caused by: javax.ws.rs.WebApplicationException: org.eclipse.jetty.io.EofException
    at org.neo4j.server.rest.repr.formats.StreamingJsonFormat$StreamingRepresentationFormat.flush(StreamingJsonFormat.java:401)
    at org.neo4j.server.rest.repr.formats.StreamingJsonFormat$StreamingRepresentationFormat.complete(StreamingJsonFormat.java:389)
    at org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:43)
    at org.neo4j.server.rest.repr.OutputFormat$1.write(OutputFormat.java:160)
    ... 30 more
Caused by: org.eclipse.jetty.io.EofException
    at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:186)
    at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:335)
    at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:125)
    at org.eclipse.jetty.server.HttpConnection$ContentCallback.process(HttpConnection.java:784)
    at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:79)
    at org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:356)
    at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:631)
    at org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:661)
    at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:151)
    at com.sun.jersey.spi.container.servlet.WebComponent$Writer.flush(WebComponent.java:315)
    at com.sun.jersey.spi.container.ContainerResponse$CommittingOutputStream.flush(ContainerResponse.java:145)
    at org.codehaus.jackson.impl.Utf8Generator.flush(Utf8Generator.java:1091)
    at org.neo4j.server.rest.repr.formats.StreamingJsonFormat$StreamingRepresentationFormat.flush(StreamingJsonFormat.java:397)
    ... 33 more
Caused by: java.io.IOException: Broken pipe
    at sun.nio.ch.FileDispatcherImpl.writev0(Native Method)
    at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51)
    at sun.nio.ch.IOUtil.write(IOUtil.java:148)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:524)
    at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:167)
    ... 45 more

Apr 09, 2014 11:10:17 AM com.sun.jersey.server.impl.application.WebApplicationImpl _handleRequest
SEVERE: The response of the WebApplicationException cannot be utilized as the response is already committed. Re-throwing to the HTTP container
javax.ws.rs.WebApplicationException: javax.ws.rs.WebApplicationException: org.eclipse.jetty.io.EofException
    at org.neo4j.server.rest.repr.OutputFormat$1.write(OutputFormat.java:174)
    at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:71)
    at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:57)
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1506)
    at org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1477)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:211)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
    at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:445)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
    at java.lang.Thread.run(Thread.java:744)
Caused by: javax.ws.rs.WebApplicationException: org.eclipse.jetty.io.EofException
    at org.neo4j.server.rest.repr.formats.StreamingJsonFormat$StreamingRepresentationFormat.flush(StreamingJsonFormat.java:401)
    at org.neo4j.server.rest.repr.formats.StreamingJsonFormat$StreamingRepresentationFormat.complete(StreamingJsonFormat.java:389)
    at org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:43)
    at org.neo4j.server.rest.repr.OutputFormat$1.write(OutputFormat.java:160)
    ... 30 more
Caused by: org.eclipse.jetty.io.EofException
    at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:186)
    at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:335)
    at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:125)
    at org.eclipse.jetty.server.HttpConnection$ContentCallback.process(HttpConnection.java:784)
    at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:79)
    at org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:356)
    at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:631)
    at org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:661)
    at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:151)
    at 

让我知道我做错了什么。

这更接近你想要做的吗

MATCH (I:Interface)
FOREACH(
  p in FILTER(z in {props}
    WHERE z.OrigIPAddress = I.IfIPAddress or z.TermIPAddress = I.IfIPAddress) | 
  MERGE (I)-[r:link]->(:Interface {IfIPAddress:p.TermIPAddress})
  SET I.IfIPAddress = p.OrigIPAddress, r = p
);

在谷歌搜索之后,我终于发现了这个问题。 它的服务器超时。由于执行查询需要一些时间,因此服务器正在超时并发送响应

我增加了超时时间,它成功了 下面是关于如何增加它的参考。

谢谢cybersam,但如果它不存在,它将在这里创建一个源接口,并将其ifIPAddress设置为p.OrigIPAddress,我不希望这样。我不想更新任何接口信息,只想更新已经存在的接口(如果存在)之间的链接。我修改了查询,但仍然不更新链接。这里是修改后的查询匹配(I:Interface)FOREACH(FILTER中的p(z in{props},其中z.OrigIPAddress=I.IfIPAddress和z.TermIPAddress=I.IfIPAddress)| MERGE(I{IfIPAddress:p.OrigIPAddress})->(在匹配集r=p上的创建集r=p上的I{IfIPAddress:p.TermIPAddress})有一种方法可以逐行调试我的查询。我在某个地方读到,我们不能从for循环返回,那么如何逐行检查它呢?