Schema {} command does not capture relationships between nodes and edges

We want to be able to track changes to our DGraph schema (via export) and use it to maintain an accurate model of our graph via draw.io or some other graphing tool (recommendations?).

I can fetch the schema using:
schema {
type
index
reverse
tokenizer
}

but how do I capture the relationships between nodes and edges?

You can use Ratel Ratel Installer for Linux, MacOs and Windows (UPDATED 2020)

You will be able to pull the schema, edit it and so on. However, there is no way you automatically pull relationships. You’ll have to build your queries based on the schema.

But it’s easy to start debugging your Nodes.

Let’s say you have a Node with the predicate (attribute) “Name”. So you would build:

{
debug(func: has(name)) {
   uid
   expand(_all_)
}

}

or Expand Predicates
https://docs.dgraph.io/query-language/#expand-predicates

{
debug(func: has(name)) {
   uid
  _predicate_
}

}

Expanding predicates you will know that the Node that has the word “Name” has other predicates. You’ll collect this list and then use it as you need it.

Or use Filters:
Let’s say you use “Name” on more than one node. And know that the Node you are looking for has another known predicate. Then you search for one and filter for another.

{
debug(func: has(name))@filter(has(boards)) {
   uid
  _predicate_
}

}

A more advange search:

{
  var(func: eq(name@en, "Lost in Translation")) {
    pred as _predicate_
    # expand(_all_) { expand(_all_)}
  }

  director(func: eq(name@en, "Lost in Translation")) {
    name@.
    expand(val(pred)) {
      expand(_all_)
    }
  }
}

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