How to use javaclient invoking upsert

upsert {
query {
q(func: eq(ID,32)) {
v as uid

  mutation {
    set {
      uid(v) <ID> "2" .
      uid(v) <NAM> "first last 32" .
      uid(v) <email> "" .

use DgraphClient dgraphClient to invoking detail

Equivalent code to perform the upsert operation using Java client would be:

String query = "query {\n" +
  "q(func: eq(ID, \"32\")) {\n" +
  "v as uid\n" +

Mutation mu = Mutation.newBuilder()
    .setSetNquads(ByteString.copyFromUtf8("uid(v) <ID> \"2\" . \n"+
        "uid(v) <NAM> \"first last 32\" .\n" +
        "uid(v) <email> \"\" .\n"))

Request request = Request.newBuilder()

If you want to learn more about using the java client, dgraph4j, check out the instructions in README.

Thank you for helping me solve the problem, but I have encountered a new problem, I hope you can help me look, as follows
delete {
<0x1> <0x2> .
how to use java DgraphClient dgraphClient to invoking

The delete query doesn’t look right.
Could you please tell me what is your goal here?
Do you wish to delete all the triples from the nodes with 0x1 and 0x2 UIDs?
Or, you got to delete an edge between these nodes?
You can check out this tour page to know about delete query.

After you get the right query, you can use either deleteEdges or setDelNquads for subject * * deletion.