Upsert with @hasInverse

Create two-way edge between two nodes.

  1. I was able to create both nodes fine in Ratel, but when query, edge(s) doesn’t who up in the Ratel node properties
  2. Also, both nodes show up in the Ratel UI but they are not connected, does the Ratel automatically render the edge?
  3. In my below query code snippet, I’m querying for both nodes, is there a way to simple way?
    {
     find_conceptId(func: eq(Person.personId, "9110"))  {
      uid
      Person.personId
      Person.hcs
      Person.docInstance
      Person.hasPersonalDetailChanges
    }
    
     find_person_change(func: eq(PersonalDetail.codeId, "10")) {
      uid
      PersonalDetail.codeId
      PersonalDetail.ethnicityId
      PersonalDetail.genderId
      PersonalDetail.maritalStatusId
      PersonalDetail.raceIds
      PersonalDetail.timestamp
      PersonalDetail.person
     } 
    }
    
  4. Below is code upsert code snippet
    upsert {
     query {
      PersonUid as var (func: eq(Person.personId, "9110"))
      PersonDetailUid as var (func: eq(PersonDetail.codeId, "10"))
     }
     mutation {
      set{
       uid(PersonUid) <Person.personId> "9110" .
       uid(PersonUid) <Person.hcs> "foo" .
       uid(PersonUid) <Person.docInstance> "7861" .
       uid(PersonUid) <Person.hasPersonalDetailChanges> uid(PersonDetailUid) .
       uid(PersonDetailUid) <PersonalDetail.person> uid(PersonUid) .
      }
     }
    }
    
  5. Below are my types
    type PersonDetail {
      codeId: Int! @id
      timestamp: Int! @search
      ethnicityId: Int!
      genderId: Int!
      maritalStatusId: Int!
      raceIds: Int!
      person: Person
    }
    type Person {
      personId: String! @id
      hcs: String! @search
      docInstance: String! @search
      hasPersonalDetailChanges: [PersonalDetail] @hasInverse(field: person)
    }
  • I got this working with below query snippet, Ratel automatically rendered the edge. Is there way to simple this?
    {
     node(func: eq(Person.persontId, "9110"))  {
     uid
     Person.personId
     person.hcs
     Person.docInstance
     Person.hasPersonalDetailChanges {
       uid
       codeId
      }
     }
    }