【问题标题】:Is there any specific way to write limit clause in eclipse for neo4j?是否有任何特定的方法可以在 Eclipse 中为 Neo4j 编写限制子句?
【发布时间】:2015-07-06 16:52:22
【问题描述】:

我在 neo4j eclipse 实现中遇到以下问题:

1 .限制函数出现错误

Code:
      String rows = "";        
    try ( Transaction ignored = graphDb.beginTx();
            Result result = graphDb.execute( "match(pr:Provider)-[t:TREATS]->(p:Problem) return pr.prdes as Name, t.pprcount as Visits, limit 5" ) )
      {
          while ( result.hasNext() )
          {
              Map<String,Object> row = result.next();
              for ( Entry<String,Object> column : row.entrySet() )
              {
                   rows += column.getKey() + ": " + column.getValue() + "; ";
              }
              rows += "\n";
          }
      }
    System.out.println(""+rows);

}

Output:
Exception in thread "main" org.neo4j.graphdb.QueryExecutionException: Invalid input '5': expected whitespace, comment, node labels, MapLiteral, a parameter, a relationship pattern, '(', '.', '[', "=~", IN, IS, '^', '*', '/', '%', '+', '-', '<', '>', "<=", ">=", '=', "<>", "!=", AND, XOR, OR, AS, ',', ORDER, SKIP, LIMIT, LOAD CSV, START, MATCH, UNWIND, MERGE, CREATE, SET, DELETE, REMOVE, FOREACH, WITH, RETURN, UNION, ';' or end of input (line 1, column 97 (offset: 96)) "match(pr:Provider)-[t:TREATS]->(p:Problem) return pr.prdes as Name, t.pprcount as Visits, limit 5"                                
  1. 在没有限制子句的情况下,执行上述查询也需要大约 50 分钟。那么如何提高性能速度呢?

【问题讨论】:

  • 无限制运行会返回多少数据?

标签: neo4j graph-databases neo4j-java-api


【解决方案1】:

limits之前不能有逗号,试试

match(pr:Provider)-[t:TREATS]->(p:Problem) 
return pr.prdes as Name, t.pprcount as Visits limit 5

改为。

由于这是一个没有定义起点的全局查询,其执行时间当然取决于您的数据大小。

【讨论】:

    猜你喜欢
    • 2019-08-29
    • 1970-01-01
    • 1970-01-01
    • 2010-12-11
    • 1970-01-01
    • 2010-11-24
    • 1970-01-01
    • 2012-07-03
    • 1970-01-01
    相关资源
    最近更新 更多