Bugs or missuse - Querying from several "root" nodes

All right so, I have this schema:

mutation {
  schema {
    graph: string @index(exact,term) .
    dummy_param: string @index(exact,term) .
    edge: uid @count .
    name: string @index(exact,term) .
  }
}

I create two root nodes by running:

mutation {
  set {
    _:root <graph> "graph1" .
    _:root <dummy_param> "graph1" .
    _:root <name> "root" .
  }
}

And then:

mutation {
  set {
    _:root <graph> "graph2" .
    _:root <dummy_param> "graph2" .
    _:root <name> "root" .
  }
}

Then I query:

{
  recurse(func:eq(name, "root")){
    name
    graph
    edge
  }
}

And I get what I show as “first” in the attached image.

Then I add a node to “graph1”:

mutation {
   set {
      <0x7538> <edge> _:node1 .
      _:node1 <name> "node1" .
      _:node1 <graph> "graph1" .
  }
}

But if I query like this again:

{
  recurse(func:eq(name, "root")){
    name
    graph
    edge
  }
}

I get what I put as “second” in the attached image.

Shouldn’t the result be something more like what I put as “third” in the attached image?:

Hey @RafaARV

You are right, you should be getting something like the image 3. If you look at the JSON response, you’ll notice that is what you get. The UI here hides root nodes with no children when there are root nodes with children. I think this behavior is a bit misleading so I will change it to display root nodes which don’t have children too.

Thank you Pawan,

You are right, this is a GUI error. The JSON brings the result as desired:

{
  "data": {
    "recurse": [
      {
        "_uid_": "0x75bd",
        "name": "root",
        "graph": "graph1",
        "edge": [
          {
            "_uid_": "0x75c3",
            "name": "nodo1",
            "graph": "graph1"
          }
        ]
      },
      {
        "_uid_": "0x75c0",
        "name": "root",
        "graph": "graph2"
      }
    ],
    "server_latency": {
      "parsing": "100µs",
      "processing": "957µs",
      "json": "120µs",
      "total": "1ms"
    }
  }
}

Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.