What is UQL
Ultipa Graph Query Language, or UQL, is a high-performance query and management language exclusive to Ultipa Graph Database and Graph Computing Engine.
UQL supports the insertion, deletion, and updating of metadata, querying of graph data (metadata, paths, and subgraphs), management of graphset, schema, property, index, process and task, user, privilege and policy, and other features within the Ultipa Graph system.
UQL can be invoked via Ultipa CLI (Command Line Tool), Ultipa Manager (a highly visualized graph database query and management interface), Ultipa Drivers (Ultipa SDKs and APIs), and the Visual Studio Code.
How UQL Operates
When a formatted UQL statement is sent to the Ultipa server, it undergoes parsing and optimization before being assigned to the high-performance graph computing engine for execution. The query result is then processed, assembled, and ultimately returned to the user.
How UQL is Designed
The design of UQL is rooted in a profound comprehension of graphs and the industry's requirements for scalable graph systems. It embraces a semantic assembly logic that mirrors the cognitive processes of the human brain, making it easy to read, write, and learn.
UQL vs. SQL
UQL naturally addresses SQL's limitations in expressing high-dimensional data and its combinations, as well as the complexity and inefficiency in path filtering. It also tackles the challenges associated with understanding and maintaining code.
Like most database languages, UQL encompasses features for DQL, DDL, DML and DCL:
- DQL (Data Query Language): Retrieve data such as nodes, edges, paths and subgraphs from the graph database.
- DDL (Data Definition Language): Define graph structure (schema and properties), create indexes, etc.
- DML (Data Manipulation Language): Add, modify, and delete data and other content within the graphset.
- DCL (Data Control Language): Manage access to the database and its objects, granting or revoking permissions to users for specific operations.
As a graph query language, UQL aligns with the GQL international standard in terms of overall functionality and compatibility. The development of the GQL standard is spearheaded by LDBC (Linked Data Benchmark Council) and is expected to be released in 2024.
Ultipa is a member of LDBC and has been actively involved in the development of the GQL standard.
UQL Components
This is an example of a UQL statement:
n({_id == "CA001"}).e({time > prev_e.time})[3].n(as target)
group by target.level
with count(target) as quantity
order by quantity desc
return target.level, quantity limit 10
Which contains,
- Chained Clause: It follows the style of
[command].[method].[method]...
, such as n(...).e(...)[3].n(...). This clause is commonly used for retrieving data from the graph or executing insertion, update or deletion. - Keyword Clause: It begins with a keyword like group by, with, order by, return and limit. This clause is used to process, assemble or return the results.
- Custom Alias: Defined with the keyword as, as seen in the example with target and quantity. These aliases are used to store and transfer temporary results between clauses.
- System Alias: Used without definition, as demonstrated with prev_e in the example. These aliases can store and transfer temporary results within a clause.
- Function: Used to perform various calculations on the temporary results. A function should be applied within a clause, as illustrated by count(...) in the example.
UQL supports escape character
\
, tab\t
, carriage return line feed\r\n
, and comment delimiters//
,/*
and*/
.
Change Log (v4.3 → v4.4)
Server Updates
- Optimized in-memory storage, reducing data memory usage by up to 33%
New Features
- Introduced a new graph data type GRAPH.
- Added new aggregation functions
percentileCont()
andpercentileDisc()
. - Added new type conversion function
toGraph()
. - Added new SET clause.
Modifications
- Renamed the query command
graph()
tosubgraph()
The UQL (Ultipa Query Language) is created and designed by Ultipa Team.
Documentation license: Creative Commons 4.0