我正在使用Neo4j 1.8.RC1,并尝试为图形中的节点生成聚类系数。
我有以下代码,据我所知,它在Linux系统上工作,但在Windows计算机上不工作:
Map<String, Object> params = new HashMap<String, Object>();
String query;
String typeString;
if (type == <some type>) {
typeString = "TYPE1";
}
else {
typeString = "TYPE2";
}
params.put("myid", userid);
query = "start a=node(*) match (a)-[:"+ typeString +"]-(b) WITH a, count(distinct b) as n "
+ "match (a)-[:" + typeString + "]-()-[r:"+ typeString+"]-()-[:"+typeString+"]-(a) where a.thisId! = {myid} return n, count(distinct r) as relcount";
ExecutionEngine engine = new ExecutionEngine(graphDb);
ExecutionResult result = engine.execute(query, params);
当我尝试访问结果时,我得到
Exception in thread "main" java.lang.RuntimeException: org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named myid
我已逐步检查并确认它在那里。这是怎么回事?
最佳答案
正如上面的评论所指出的,此问题已通过从1.8.RC1更新到1.8.2得以解决。尽管我没有bug报告,但这显然是Neo4j中的一个bug,已在这些版本之间解决。