Consider supporting edge naming via value variable

Moved from GitHub dgraph/4700

Posted by MichelDiz:

Experience Report

What you wanted to do

Make a direct migration from Neo4J to Dgraph using the JSON structure that is exported via APOC.

What you actually did

  uid(from) <val(EDGE)> val(to) .
upsert {
  query {
      var(func: has(properties)) @filter(eq(type,"relationship") AND NOT has(migrationDone) ){
      EDGE as label
      properties {
        summary as summary
        rating as rating
        roles as  roles
      }
      start {
        ID as id
      }
      end {
        endID as id
      }
      summaryMe as sum(val(summary))
      ratingMe as sum(val(rating))
      rolesMe as sum(val(roles))
    }
    from(func: eq(id, val(ID) )) @filter(NOT eq(type,"relationship") AND NOT has(~start) AND NOT has(~end)) {
     from as uid
    }
    to(func: eq(id, val(endID) )) @filter(NOT eq(type,"relationship") AND NOT has(~start) AND NOT has(~end)) {
     to as uid
    }
  }

  mutation {
    set {
      uid(from) <migrationDone> "True" .
      uid(from) <val(EDGE)> val(to) .
       # (...)
    }
  }

}

mangalaman93 commented :

I believe this is too much to expect from the query language. This should be done through a script instead.