给定以下代码:
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(*) 匹配 (n)-[警告]->(x) 返回 n,x,警告列表 (n, x ,注意)
org.neo4j.rest.graphdb.RestGraphDatabase.getNodeManager(RestGraphDatabase.java:33) 的 org.neo4j.rest.graphdb.AbstractRemoteDatabase.getNodeManager(AbstractRemoteDatabase.java:136) 的线程“main”java.lang.UnsupportedOperationException 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) at org.neo4j.cypher.internal.executionplan.builders.GraphGlobalStartBuilder$$anonfun$createStartPipe$1.apply(GraphGlobalStartBuilder.scala:51) at 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) at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371) at scala.collection.Iterator$$anon $13.hasNext(Iterator.scala:371) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at org .neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:36) at org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala: 35) 在 org.neo4j.cypher.internal.ClosingIterator.failIfThrows(ClosingIterator.scala:87) 在 org.neo4j 的 org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35) .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)