Updated on 2024-01-03 GMT+08:00

DSL Query

DSL is a graph query language. You can use DSL statements to query and compute graphs, helping you design and run algorithms at low costs. This function applies only to graphs of 2.3.14 or later.

The procedure is as follows:

  1. Log in to the GES graph editor. For details, see Accessing the GES Graph Editor.
  2. In the graph data query area, click the drop-up button to choose DSL. Enter a query statement and press Enter to run the statement.
    Figure 1 Switching to DSL query

Multi-label graphs do not support DSL query.

Common DSL Query Statements

The following are typical query statements.

  • Querying a vertex

    Match<Vertex> v(['Vivian','Eric']);return v: Query vertices whose IDs are Vivian and Eric.

  • Querying neighbor vertices in N hops

    Match<Vertex> v(['Vivian']);v.repeat(bothV()).times(2).emit();return v: Query all neighbor vertices in two hops in both directions of a vertex whose ID is Vivian.

  • Returning a subgraph

    Match<Vertex> v(['Vivian','Eric']); return v.subgraph(): Return vertices Vivian and Eric and the edge set between them.

  • Other statements

    Match<Vertex> v(); v.pick(1); return v: Randomly match and return one vertex.

    Match<Vertex> v(); v.pattern('match (n:user) return n'); return v: // Use Cypher statements to query and return the vertex set.

  1. You can press the up and down arrow keys in the text box to view historical query commands.
  2. When you enter a syntax keyword, the system automatically displays historical statements with the same keyword.
  3. Keywords in the text box are displayed in different colors.
    • Reserved words in gray

      Note: A reserved word is predefined in the syntax system of a programming language. Reserved words vary depending on programming languages.

    • String values in orange
    • Key-value pairs in purple. They are of the non-string type in the key:value format.
    • Delimiters in red. Regular delimiters including square brackets [], curly brackets {}, parenthesis (), commas (,), and semicolons (;).
    • Variables in green
    Figure 2 DSL keywords