【发布时间】:2013-02-18 02:35:00
【问题描述】:
给定以下代码:
public class Foo
{
public void go(String relationship)
{
RestGraphDatabase rest = new RestGraphDatabase(
prop.getProperty("address"), prop.getProperty("username"),
prop.getProperty("password"));
ExecutionEngine engine = new ExecutionEngine(rest,
StringLogger.SYSTEM);
ExecutionResult result = engine
.execute("start n=node(7,8,9) match(n)-[" + relationship
+ "]->(x) return n,x,caution");
scala.collection.Iterator<Node> nodes = result.columnAs("n");
}
}
上述方法有效,但允许我遍历我的列:
public class Foo
{
public void go(String relationship)
{
RestGraphDatabase rest = new RestGraphDatabase(
prop.getProperty("address"), prop.getProperty("username"),
prop.getProperty("password"));
ExecutionEngine engine = new ExecutionEngine(rest,
StringLogger.SYSTEM);
ExecutionResult result = engine
.execute("start n=node(*) match(n)-[" + relationship
+ "]->(x) return n,x,caution");
scala.collection.Iterator<Node> nodes = result.columnAs("n");
}
}
导致迭代器抛出不受支持的异常。 node(*) 不是列出值的语法糖吗?如果不是,我该如何node(*) 并对其进行迭代?
堆栈:
2013-02-18 03:13:22.227+0000 信息 [org.neo4j]: 开始 n=node(*) match(n)-[caution]->(x) return n,x,caution List(n, x,caution)
线程“main”中的异常 java.lang.UnsupportedOperationException at org.neo4j.rest.graphdb.AbstractRemoteDatabase.getNodeManager(AbstractRemoteDatabase.java:136) 在 org.neo4j.rest.graphdb.RestGraphDatabase.getNodeManager(RestGraphDatabase.java:33) 在 org.neo4j.tooling.GlobalGraphOperations.(GlobalGraphOperations.java:39) 在 org.neo4j.tooling.GlobalGraphOperations.at(GlobalGraphOperations.java:51) 在 org.neo4j.cypher.internal.executionplan.builders.GraphGlobalStartBuilder$$anonfun$createStartPipe$1.apply(GraphGlobalStartBuilder.scala:51) 在 org.neo4j.cypher.internal.executionplan.builders.GraphGlobalStartBuilder$$anonfun$createStartPipe$1.apply(GraphGlobalStartBuilder.scala:51) 在 org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$createResults$1.apply(StartPipe.scala:36) 在 org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$createResults$1.apply(StartPipe.scala:35) 在 scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371) 在 scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) 在 scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) 在 org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:36) 在 org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35) 在 org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35) 在 org.neo4j.cypher.internal.ClosingIterator.failIfThrows(ClosingIterator.scala:87) 在 org.neo4j.cypher.internal.ClosingIterator.hasNext(ClosingIterator.scala:35) 在 org.neo4j.cypher.PipeExecutionResult.hasNext(PipeExecutionResult.scala:139) 在 scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) 在 scala.collection.Iterator$class.isEmpty(Iterator.scala:256) 在 scala.collection.AbstractIterator.isEmpty(Iterator.scala:1156)
【问题讨论】:
-
A tstorms 说,永远不要使用 RestGraphDatabase 周围的 ExecutionEngine,使用 RestCypherQueryEngine 或 RestAPIFacade.query()。