Notebook code editor in DataStax Studio

The Notebook code editor supports a subset of the Groovy programming language.

The Notebook code editor supports a subset of the Apache Groovy programming language.

A notebook connects to a DSE cluster based on the connection information. Each notebook has only one connection. One piece of information connection specifies is its Graph Name.

The code editor provides pre-defined alias variables:

The variable that refers to the graph.
The traversal source associated with the graph for OLTP graph traversals.
The traversal source associated with the graph for OLAP graph traversals.

A drop-down list shows for content-assist on a blank line in the editor.

The code editor supports inline code validation. If some code is invalid or uses Groovy syntax that the editor does not support, the invalid code is displayed with a red underlining.

Content assistance

The code editor provides content assistance (Ctrl+Space).

Content-assistance proposes content based on context:
  • Methods
  • Variables
Press Return to select the highlighted choice from the assistance list.

You can filter proposals by typing enough characters to select a line in the pull-down menu.

Use Shift-Tab to return to the beginning of a line.

Code validation

The notebook editor performs validation as code is entered into the cell. You can turn off validation on a per-cell basis. To turn off validation in a cell, move the slider to Disable editor validations.

The notebook editor supports these validations:
Groovy syntax
The code in a cell is executed within DSE Graph as Groovy. The notebook editor adds enough Groovy syntax support for you to craft your Gremlin statements.

The code in a cell is also checked for type. If you try to call a method on an object of the wrong type or pass a parameter of an invalid type, a validation error is displayed.

Common errors in code are pointed out when possible.

The code editor cells in a notebook have no Gremlin session scope context and rely on an implicit scope based on their order. Validation occurs from the top cell down in the order in the notebook. If you execute code out of order, validation errors can occur even if the code executes successfully.

Groovy language support


  • variable declarations in Groovy style:
    • def foo
    • def SomeType foo
    • SomeType foo
    • Shell-style variables
  • method invocations
  • optional semicolons to complete statements
  • generics
  • strings in both forms:
    • '123'
    • "123"
  • for loops: basic and for in syntax
  • while loops
  • try-catch-finally: a type is required for catching the exception
  • if-else statements
  • switch statements
  • casting in both styles: (SomeType) foo and foo as SomeType
  • list literals

Unsupported Groovy language

  • closures
  • multi-variable assignment and other advanced variable assignments like object deconstruction
  • import statements explicitly disabled
  • map literals or other complex type literals that are not supported by Java
  • try-catch-finally: multi-catch is not supported

Notebook information

Selecting Information displays:
  • Connection being used for the notebook.
  • Last update to the notebook.
  • Version of Studio JAR file being run.

Notebook schema

Selecting Information displays the current graph schema for the notebook.

In addition to visual schema representation, the code-assist feature also provides schema-assist proposals.

That’s a lot of proposals. Let’s break them down:
  • The editor is intelligent enough to know that this is a Vertex-based traversal (because of type inference) and presents only the schema proposals that are relevant for vertex properties and keys.
  • Because there are multiple has methods, Studio proposes possibilities for all of these variations.
  • The editor concretely makes a proposal for each possible property key.