Examining schema
How to examine schema.
Examining schema can be done to either verify the existence or non-existence of schema before creation.
Procedure
-
A list of all schema can be retrieved with the following command:
schema.describe()
In Studio and Gremlin console, a list is retrieved, although the presentation is different. Here is a portion of a Studio result:
-
The schema for a particular element can be examined by appending
describe()
to a more specific schema:schema.edgeLabel('includedIn').describe()
schema.edgeLabel("includedIn").multiple().properties("amount").create() schema.edgeLabel("includedIn").connection("recipe", "meal").connection("recipe", "book").connection("recipe", "ingredient").connection("ingredient", "recipe").connection("meal", "book").add()
-
Some groovy steps are useful in the Gremlin query to find specific schema
descriptions. For instance, to inspect only the vertex labels and their indexes,
use the
split()
andgrep()
steps:schema.describe().split('\n').grep(~/.*vertexLabel.*/)
In Studio: