Graph data is dimensionally higher than tables, so that requires a more flexible and extensible organizational form to achieve the retrieval, traversal and acquisition of data. Unlike relational databases, graph traversal is more complex and diverse. For instance, it is necessary to use different logic or judgement rules to walk through the paths, which differs greatly from using only the nested forms in SQL. UQL is designed from the comprehension of data, graph data and graph computing business, it aims at making it clearly defined and easier for users to understand and operate. Therefore, UQL helps graph database operators to design complex graph query tasks more conveniently so that they may focus on business data query design, logic combing, and data operation and maintenance.
UQL integrates the features of functional programming language linguistically, retains the features of Data Manipulation Language (DML), and undergoes a large number of upgrades and optimizations to ensure better execution performance while keeping the flexibility and convenience.
The structured UQL sentences will be parsed and optimized once being delivered to Ultipa server, after which to be allocated to the high performance graph computing engine for graph query, and the query result is finally returned to user after the rest processing and assembling is performed.
This chapter will introduce the query, alias and return mechanism of UQL as a whole, with the purpose of giving users a general understanding. If user has doubts while reading, please continue to study the following chapters for detailed introduction to each section.
Please see an UQL example:
find().nodes() as target return target limit 10
where:
- find().nodes() initiates a query of node;
- as target defines an alias, the query result of the previous sentence is expressed as alias "target";
- return target assembles the returned value, which is the value of "target";
- limit 10 sets the limit of the amount of data to return, here is 10 the maximum.
The green part find().nodes() is the UQL query statement styled as [command].[parameter].[parameter]...
, a complex UQL sentence may contain multiple query statements, and the result of query serves as the input and processing source of subsequent statements. Later in this chapter, the concept and usage of various query commands and their parameters will be introduced in turn.
The orange part return and limit are clause keyword. Clause is used to compute and process the result delivered from the previous statements (functional operation, aggregation, sorting, Cartesian product combination, etc.). Read chapter Data Stream, Clause for a detailed description of clause keyword.
The red part as is the alias keyword that defines alias for the current result so that it can be used in subsequent statements. Alias is link that makes various parts of UQL to work together.