1

我的 neo4j 架构中有大约 20000 个奇怪的节点和关系。我正在尝试查询该数据并显示在我的浏览器中。我正在使用带有 Spring jdbcTemplate 的 neo-4j java 驱动程序。但在查询 MATCH(n)<-[r]-(m) 下返回 n,type(r),m 限制 100

 final String GRAPH_QUERY = "MATCH(n)<-[r]-(m) return n,type(r),m limit 100";

    Iterator<Map<String, Object>> result = template.queryForList(
            GRAPH_QUERY, limit == null ? 100 : limit).iterator();
     while ( result.hasNext() )
        { 
              //store result in a hashmap or something
       }
      //There is only one row returned in the result above.

它在 Java 中只返回一行,而如果我在 neo4j shell 或控制台中运行它,这个相同的查询将返回所有节点和关系。很奇怪。有什么原因吗?

pom.xml 依赖项

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>false</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
        <version>${spring-boot.version}</version>
    </dependency>
    <dependency>
        <groupId>org.neo4j.driver</groupId>

        <artifactId>neo4j-java-driver</artifactId>

        <version>1.0.3</version>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-jdbc</artifactId>
            <version>2.3.2</version>
    </dependency>
   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jetty</artifactId>
        <version>${spring-boot.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.1</version>
    </dependency>

除了我在上面发布的内容之外,代码没有太多内容。如果我使用结果迭代器进行迭代,它只会给我一个结果。

4

0 回答 0