Skip to content

Dgraph v1.1.0: Visualization does not show one-to-one edges #106

@danielmai

Description

@danielmai

Dgraph v1.1.0 supports specifying one-to-one edges using the uid schema type. e.g.,

friend: uid .

This enforces the predicate to only have a single outgoing edge per node. e.g., instead of having a list of friends, each person would only be allowed to have one friend.

hypermodeinc/dgraph#2921 changed the query response for one-to-one uid edges to output as a single JSON map instead of an array. This breaks the graph visualization for one-to-one edges.

Steps to reproduce

Set schema for a single uid edge:

friend: uid .

Set mutation:

{
  "set": [
    {
      "name": "Alice",
      "friend": {
        "name": "Bob"
      }
    }
  ]
}

Run query:

{
  q(func: has(name)) {
    name
    friend {
      name
    }
  }
}

Query response (does not have JSON array for "friend"):

{
  "data": {
    "name": "Alice",
    "friend": {
      "name": "Bob"
    }
  }
}

Query visualization in Ratel:

image

Expected results

The visualization should show the friend edge. This works for [uid] edges, as shown below.

Steps to reproduce expected results

Set schema for list [uid] edge:

friend: [uid] .

Set mutation:

{
  "set": [
    {
      "name": "Alice",
      "friend": {
        "name": "Bob"
      }
    }
  ]
}

Run query:

{
  q(func: has(name)) {
    name
    friend {
      name
    }
  }
}

Query response (JSON array for "friend"):

{
  "data": {
    "name": "Alice",
    "friend": [
      {
        "name": "Bob"
      }
    ]
  }
}

image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions