AQL (ArangoDB Query Language)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

AQL is the SQL-like query language[1] used in the ArangoDB database management system. It supports CRUD operations for both documents (nodes) and edges, but it is not a data definition language (DDL). AQL does support geospatial queries.

AQL is JSON-oriented as illustrated by the following query, which also illustrates the intuitive "dot" notation for accessing the values of keys:

FOR x IN [{"a": {"A":1}}, {"a": {"A": 2}}]
    FILTER x.a.A < 2
    RETURN x.a

Example[edit]

The following is a parameterized query for finding the number of descendants of a particular node (@start) in a graph named @g with @max nodes:

FOR v IN 1 .. @max OUTBOUND @start GRAPH @g
    OPTIONS {uniqueVertices: "global", bfs: true }
COLLECT WITH COUNT INTO c
RETURN c

The uppercase words are AQL keywords. Notice how AQL is graph-aware. The OPTIONS are necessary to ensure the query can be run on a graph with cycles; "bfs" stands for breadth-first search.

References[edit]

  1. ^ "SQL and AQL (ArangoDB Query Language) Comparison". Arangodb.com. Retrieved 17 December 2017.

External References[edit]