AQL (ArangoDB Query Language)
From HandWiki
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
(Learn how and when to remove this template message)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
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
- ↑ "SQL and AQL (ArangoDB Query Language) Comparison". https://www.arangodb.com/why-arangodb/sql-aql-comparison. Retrieved 17 December 2017.
External References