dgraph icon indicating copy to clipboard operation
dgraph copied to clipboard

Consider supporting edge naming via value variable

Open MichelDiz opened this issue 5 years ago • 2 comments

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) .
       # (...)
    }
  }

}

MichelDiz avatar Jan 30 '20 04:01 MichelDiz

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

mangalaman93 avatar Feb 18 '20 21:02 mangalaman93

Github issues have been deprecated. This issue has been moved to discuss. You can follow the conversation there and also subscribe to updates by changing your notification preferences.

drawing

minhaj-shakeel avatar Jul 16 '20 13:07 minhaj-shakeel