Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rest 不必要的(?)节点附加标签请求_Rest_Neo4j_Label_Spring Data Neo4j - Fatal编程技术网

Rest 不必要的(?)节点附加标签请求

Rest 不必要的(?)节点附加标签请求,rest,neo4j,label,spring-data-neo4j,Rest,Neo4j,Label,Spring Data Neo4j,首先,我的设置是: spring-data-neo4j version: 3.0.0.RELEASE spring-data-neo4j-rest version: 3.0.0.RELEASE 我正在使用spring neo4j配置和远程REST DB访问: @Configuration @EnableTransactionManagement @EnableNeo4jRepositories(basePackages = "my.package.repository") public c

首先,我的设置是:

spring-data-neo4j version: 3.0.0.RELEASE
spring-data-neo4j-rest version: 3.0.0.RELEASE 
我正在使用spring neo4j配置和远程REST DB访问:

@Configuration
@EnableTransactionManagement 
@EnableNeo4jRepositories(basePackages = "my.package.repository")
public class Neo4JConfig extends Neo4jConfiguration {

@Bean
public GraphDatabaseService graphDatabaseService() {
    return new SpringRestGraphDatabase("http://localhost:7474/db/data");
}

}    
我的存储库设置为:

public interface ProductRepository extends GraphRepository<GraphProduct>{}
问题

但出乎意料的是,在这之后,将为获取的每个节点发送后续请求:

Executing remote cypher query: match (n) where id(n)={nodeId} return labels(n) as labels params {nodeId=32}
Executing remote cypher query: match (n) where id(n)={nodeId} return labels(n) as labels params {nodeId=33}
...
可以想象,这严重损害了系统的性能(30个对象=30个额外的REST请求)

我能做些有助于避免这些额外请求的事情吗? 是否可以在一次对所有节点的批处理查询中至少返回此数据

更新

不幸的是,这个问题将持续一段时间。 我使用了@Gwendal谷歌小组讨论链接,现在似乎没有解决办法

我能想到的唯一解决方案是回到节点属性中的类名

在GG讨论中:

unfortunately labels are not returned from any of the endpoints with the nodes automatically, so they have to be fetched separately.

Sorry for that.

You can return to the Indexed type-representation strategy with using this config:

<bean id="typeRepresentationStrategyFactory" class="org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory">
    <constructor-arg index="0" ref="graphDatabase"/>
    <constructor-arg index="1" value="Indexed"/>
</bean>

<neo4j:config storeDirectory="graph.db" base-package="com.example.domain,com.example.domain2"/>
<neo4j:repositories base-package="com.example.repositories"/>
不幸的是,任何端点都不会自动返回带有节点的标签,因此必须单独获取标签。
对不起。
您可以使用以下配置返回到索引类型表示策略:

我在google group上发布了一条关于这些请求的消息:

请在回答中包含链接的相关部分。如果链接的内容发生变化,你的答案将变得毫无用处。
Executing remote cypher query: match (n) where id(n)={nodeId} return labels(n) as labels params {nodeId=32}
Executing remote cypher query: match (n) where id(n)={nodeId} return labels(n) as labels params {nodeId=33}
...
unfortunately labels are not returned from any of the endpoints with the nodes automatically, so they have to be fetched separately.

Sorry for that.

You can return to the Indexed type-representation strategy with using this config:

<bean id="typeRepresentationStrategyFactory" class="org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory">
    <constructor-arg index="0" ref="graphDatabase"/>
    <constructor-arg index="1" value="Indexed"/>
</bean>

<neo4j:config storeDirectory="graph.db" base-package="com.example.domain,com.example.domain2"/>
<neo4j:repositories base-package="com.example.repositories"/>