1
Java 바인딩 라이브러리를 사용하여 REST API로 몇 가지 사이퍼 쿼리를 함께 배치하여 와이어를 통해 하나의 호출 만 수행하려고합니다. 그러나 클라이언트 측에서 배치를 존중하지 않는 것이 오류 제공 :RestCypherQueryEngine에 의해 생성 된 일괄 시터 쿼리
graphDatabaseService.getRestAPI().executeBatch(new BatchCallback<Void>() {
@Override
public Void recordBatch(RestAPI batchRestApi) {
String query = "CREATE accounts=({userId:{userId}})-[r:OWNS]->({facebookId:{facebookId}})";
graphDatabaseService.getQueryEngine().query(query, map("userId", 1, "facebookId", "1"));
graphDatabaseService.getQueryEngine().query(query, map("userId", 2, "facebookId", "2"));
graphDatabaseService.getQueryEngine().query(query, map("userId", 3, "facebookId", "3"));
return null;
}
});
내가 noe4j 버전 1.9을 사용하고 있습니다 및 해당 : 그들을 배치하려고하는 방법
java.lang.RuntimeException: Error reading as JSON ''
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:57)
at org.neo4j.rest.graphdb.util.JsonHelper.jsonToSingleValue(JsonHelper.java:62)
at org.neo4j.rest.graphdb.RequestResult.toEntity(RequestResult.java:114)
at org.neo4j.rest.graphdb.RequestResult.toMap(RequestResult.java:123)
at org.neo4j.rest.graphdb.batch.RecordingRestRequest.toMap(RecordingRestRequest.java:138)
at org.neo4j.rest.graphdb.ExecutingRestAPI.query(ExecutingRestAPI.java:489)
at org.neo4j.rest.graphdb.ExecutingRestAPI.query(ExecutingRestAPI.java:509)
at org.neo4j.rest.graphdb.RestAPIFacade.query(RestAPIFacade.java:233)
at org.neo4j.rest.graphdb.query.RestCypherQueryEngine.query(RestCypherQueryEngine.java:50)
...
Caused by: java.io.EOFException: No content to map to Object due to end of input
at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2766)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2709)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1854)
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:55)
... 41 more
이것은이다 클라이언트 라이브러리. 이것이 가능한가?
그런데이 :이 RestAPI 테스트 케이스를 발견 https://github.com/neo4j/java-rest-binding/blob/master /src/test/java/org/neo4j/rest/graphdb/BatchRestAPITest.java – h3nrik
저는 실제로 하드 코딩 된 사이퍼 쿼리를 일괄 적으로 찾고있었습니다. 나는 neo4j 서버 배치 엔드 포인트를 치고 json에게 직접 쿼리를 인코딩하는 간단한 저지 클라이언트를 사용하여 이것을 끝내었다. 그래도 고마워! –