newBuilder() を使用せずに生の文字列変更クエリを実行できるようにする必要があります。
Gson gson = new Gson();
String json = gson.toJson(newEmployer);
Transaction newTransaction = this.dgraphClient.newTransaction();
Mutation mu = Mutation.newBuilder().setSetJson(ByteString.copyFromUtf8(json.toString())).build();
newTransaction.mutate(mu);
実行したい:
String email = "ba@a.aa";
String userType = "JOB_SEEKER";
Transaction newTransaction = this.dgraphClient.newTransaction();
String query =
"{\n" +
" set { \n" +
" _:user <label> \"USER\" . \n" +
" _:user <userType> \"" + email + "\" . \n" +
" _:user <email> \"" + userType + "\" . \n" +
" }\n" +
"}";
Mutation mu = Mutation.parseFrom(ByteString.copyFromUtf8(query));
newTransaction.mutate(mu);
しかし、実行時に次のエラーが表示されます。