I need do be able to run raw string mutation queries without using of 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);
I want to run:
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);
But I get the error on run-time: "While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length."