What is UQL
Ultipa Graph Query Language, or UQL for short, is a high-performance query and management language exclusive for Ultipa Graph Database and Graph Computing Engine, developers can quickly grasp it and get started with Ultipa Graph system.
UQL supports insert, delete and update of metadata, query of graph data (metadata, path and subgraph), GraphSet management, schema management, property management, index management, task management, permission management, and other functions on Ultipa Graph system.
UQL can be invoked via Ultipa CLI (Command Line Tool), Ultipa Manager (a highly visualized graph database query and management interface), VS Code and Ultipa Drivers (Ultipa SDKs and APIs).
Query Mechanism of UQL
A UQL statement is structured and delivered to the Ultipa server, then parsed and optimized before being allocated to the high-performance graph computing engine for graph query. The query result is processed and assembled, and finally returned to user.
Advantages of UQL Design
The design inspiration of UQL has roots in a deep understanding of graph and the demands of industry for high dimensional and extensible graphs. It adopts semantic assembly logic that is consistent with the human brain's thinking mode, and has the following advantages in design:
- clear definition of advanced data structures, such as node, edge, path, and able;
- effortless query, computation, assembly and return of one or multiple of the above data structures;
- concise description of the complex filtering conditions required for graph traversal
- grammatical structure that is easy to read, write, and learn
The design of UQL natrually solves SQL's inability to clearly express high dimensional data and its combinations, complexity and inefficiency in path filtering, difficulty in understanding and maintaining the code.
To adapot to the programming habits of a majority of developers, UQL has the syntax features of DQL, DDL, DML and DCL:
- DQL (Data Query Language): to query nodes, edges and paths in the graph;
- DDL (Data Definition Language): to add/delete GraphSet, modify schema, define properties, create index etc.;
- DML (Data Manipulation Language): to insert, delete and update the metadata and other content of GraphSet;
- DCL (Data Control Language): mainly used to manipulate database permission settings, such as user management, role management, grant and revoke of permissions etc.
As a graph query language, UQL will keep pace with the GQL international standard in terms of the overall functionality and compatibility. The development of this GQL standard is led by LDBC (Linked Data Benchmark Council) and is expected to be launched in 2024.
Ultipa team is as a member of LDBC and has participated throughout the development of GQL standard.
Components of UQL
To compose a UQL statement, one must know about chain statements, semantic assembly and alias call. The functional style of UQL fullfills today's complex data processing needs, and provides unlimited expansion space.
Below is a typical UQL example:
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
Instructions:
- Chain statement: the n(... ).e(...)[3].n(...) in the above example, styled as
[command].[parameter].[parameter]...
. to realize the operations of insertion, update, deletion and query. A UQL statement may contain multiple chain statements. - Clauses: the group by ..., with ..., order by ..., return ... and limit ... from the above example, to process and assemble query results of a UQL.
- Custom alias: the target and quantity in the example, to save and pass temporary results between statements, should be defined using as.
- System alias: the
prev_e
, to save and pass temporary results within a template. - Function: the count(...) in the above example, to perform various calculations on the temporary results. A function should be composed in a clause.
- Supports escape characters
\
, tab\t
, carriage return line feed\r\n
and comment delimiters//
,/*
and*/
.
Change Log (V4.2 to V4.3)
Server Updates:
- Refactored EXTA.
- Parameters of Server.config
private_addr
andpublic_addr
now support domain name. - Added
sub_types
in Property.
UQL New Features:
- Added new property type double, decimal, point, blob, list and set.
- Support property value of null and null-related operations.
- Aggregate functions ignore null.
- Added new spatial functions, string functions, list functions and type conversion functions.
- Added new operators IS NULL, IS NOT NULL, DISTINCT.
- Commands find() and khop() now support prefix keyword OPTIONAL.
- Added new prefix keywords TRY and DEBUG.
- Support encrypted storage and access control of properties.
- Added trigger function related to modification of metadata.
- Added server backup and restore function.
UQL Modifications:
- Function name changes:
- distinct() -> dedup()
- Function collect() keeps all the information of NODE/EDGE/PATH.
- Removed alias type ARRAY, and merge list into ATTR.
- Omitted property when inserting and property created after inserting are null.
- Refactored prefix keyword EXPLAIN and PROFILE.
The Ultipa Query Language is created and designed by Ultipa Team.
Documentation license: Creative Commons 4.0