How can I discard this part of the path when doing a recursive query?

What I want to do

How can I discard this part of the path when doing a recursive query

Below is a minimal example of my data,

{
  set {
    _:p1 <name> "node1" .
    _:p1 <id> "OhouNaPYEkLEuqER1-12" .
    _:p1 <resourceKey> "mindernode" .
    _:p1 <dgraph.type> "resource" .
    
    _:p2 <name> "node2" .
    _:p2 <id> "OhouNaPYEkLEuqER2-12" .
    _:p2 <resourceKey> "mindernode" .
    _:p2 <dgraph.type> "resource" .

    _:f1 <name> "file1" .
    _:f1 <id> "OhouNaPYEkLEuqER1-file1" .
    _:f1 <resourceKey> "file" .
    _:f1 <dgraph.type> "resource" .
    
    _:p3 <parentChild> _:p1 .
    _:f1 <parentChild> _:p2 .
    
    _:p4 <name> "node1-1" .
    _:p4 <id> "OhouNaPYEkLEuqER1-1" .
    _:p4 <resourceKey> "mindernode" .
    _:p4 <dgraph.type> "resource" .
    
    _:f2 <name> "file2" .
    _:f2 <id> "OhouNaPYEkLEuqER1-file2" .
    _:f2 <resourceKey> "file" .
    _:f2 <dgraph.type> "resource" .
    _:f2 <parentChild> _:p4 .
    _:p4 <parentChild> _:p2 .
  }
}

image

I want to do a recursive query from file1, find nodes that have node2 in their name, and find the path to the target with file1. There may be many eligible nodes under file1.

What I did


query {
   var(func: eq(id, "OhouNaPYEkLEuqER1-file1")) @recurse  {
    	uid 
        id
    	name
        ~parentChild  
    }
			
    me(func: uid(child)) @filter(allofterms(name,"node2") ) @recurse{
    	uid 
        id
    	name
        ~parentChild  
    }
}

Below is the result of my query, which contains the path of the target to file1 and file2. Because there is also a parentChild relationship between the target and file2. So the returned json result contains paths that I don’t want, how can I discard this part of the paths that I don’t want when recursively querying, and only keep the path between the target and file1

{
  "data": {
    "query": [
      {
        "uid": "0x2007b66",
        "id": "OhouNaPYEkLEuqER2-12",
        "name": "node2",
        "~parentChild": [
          {
            "uid": "0x2007b63",
            "id": "OhouNaPYEkLEuqER1-1",
            "name": "node1-1",
            "~parentChild": [
              {
                "uid": "0x2007b64",
                "id": "OhouNaPYEkLEuqER1-file2",
                "name": "file2"
              }
            ]
          },
          {
            "uid": "0x2007b67",
            "id": "OhouNaPYEkLEuqER1-file1",
            "name": "file1"
          }
        ]
      }
    ]
  }
}

Dgraph metadata

dgraph version

PASTE THE RESULTS OF dgraph version HERE.