Improve facet representation

Moved from GitHub ratel/211

Posted by robin-snt:

First of all, ratel doesn’t seem to handle the new facet format correctly, showing the string literal “Object”, instead of indexing into the objects to fetch facet data.

This is for facets on UID lists:

Then I see that ratel can also show facet data in the node itself, when facets are on UID’s:

This is very inconsistent and I hope facets a represented at the edges with correct parsing of the new facet format.

I know there’s some breaking changes made to how facets are managed in dgraph, which are IMO released prematurely, making it challenging to relate to, so I understand that the ratel team is doing a great job given the circumstances.

I also see great improvements made, like edge arrows for visualizing edge direction, improved edge visibility on mouseover, many big and small updates that really improve QOL. Thank you!

paulftw commented :

@robin-snt thank you for a very detailed report, however I still struggle to reproduce it on dgraph/dgraph:master docker image.

Here’s what I did and observed:

  1. Ran a mutation to insert sample data:
  set {
    _:alice <playerId> "Alice" (weight=200) .
    _:alice <score> "1337.000001" (mode="iddqd") .
    _:alice <teammate> _:bob (weight=200,mode="iddqd") .
    _:alice <teammate> _:charlie (weight=300,mode="idkfa") .
  1. Queried the nodes and edges with facets:
  q(func: has(playerId)) {
    playerId @facets(mode, weight)
    score @facets(mode, weight)
    teammate @facets(mode, weight) {
  1. Facets are present when mouse is over a node:

  2. Facets are present when mouse is over an edge:

Can you please provide a sample facet value that causes the [Object object] string to appear?

paulftw commented :

Tried adding a boolean facet, Ratel displayed all four permutations - true and false values, on edges and on nodes

robin-snt commented :

I’m really sorry, but I left out the versions I had used while being completely certain that I had included them.

I observed this with dgraph v20.03.1 and v20.03.3. I tried the master build and it does indeed work, but master right now contains the commit that cleans up the facet mess that’s been going on ever since facet behaviour was broken initially.

The commit on master that cleans up everything: [BREAKING] Introduce new facets format (#5424) · dgraph-io/dgraph@b16b611 · GitHub

Here’s the discussion: Facets format in mutation requests and query responses

paulftw commented :

@robin-snt thanks for the update.
It seems to me that Ratel fully supports the :master facets format. That format has been accepted as final and sooner or later the PRs will make it into official release branch(es).
With that in mind I’m closing this issue.
Please feel free to re-open if you think more work is needed on the Ratel side