Graph Schemas

Graph schemas are themselves an instance of a graph. As such, they can be traversed like any other graph. The schemas are automatically added to the database following the naming pattern {graph-name}__schema__.

Get the schema of a graph

The schema of a graph can be accessed via a GET request to /v1/graph/{graph-name}/schema.

Alternatively, you can use the grip CLI: grip schema get {graph-name}.

Describing graph schemas

There are several methods for describing the schema of a graph.

Server:
  # Should the server periodically build the graph schemas?
  AutoBuildSchemas: true
  # How often the server should rebuild the graph schemas. Set to 0 to turn off
  SchemaRefreshInterval: "24h"
  # How many vertices/edges to inspect to infer the schema
  SchemaInspectN: 500
  # Strategy to use for selecting the vertices/edges to inspect.
  # Random if True; first N otherwise
  SchemaRandomSample: true

Example schema

 graph: example-graph

 edges:
- data: {}
  from: Human
  gid: (Human)--starship->(Starship)
  label: starship
  to: Starship
- data: {}
  from: Human
  gid: (Human)--friend->(Human)
  label: friend
  to: Human
- data: {}
  from: Human
  gid: (Human)--friend->(Droid)
  label: friend
  to: Droid
- data: {}
  from: Human
  gid: (Human)--appearsIn->(Movie)
  label: appearsIn
  to: Movie

vertices:
- data:
    name: STRING
  gid: Movie
  label: Movie
- data:
    length: NUMERIC
    name: STRING
  gid: Starship
  label: Starship
- data:
    name: STRING
    primaryFunction: STRING
  gid: Droid
  label: Droid
- data:
    height: NUMERIC
    homePlanet: STRING
    mass: NUMERIC
    name: STRING
  gid: Human
  label: Human