Parameters, Value
Table function can combine multiple separate columns of data into one table. In principle, the data in the same row of columns to be merged should have some corresponding relationship.
if data do not come from homologous columns, when used in WITH:
table()
will first make a Cartesian Product Combination of all columns and its homologous columns before merging; when used in RETURN,table()
will trim all columns and their homologous columns before merging.
Syntax:
- Format 1: table(
<column1>
,<column2>
, ...) - Format 2: [
<column1>
,<column2>
, ...] - Parameters: see tale below
- Value: TABLE
Name | Category | Specification | Description |
---|---|---|---|
<column> |
NODE,EDGE,ATTR | / | The column to be aggregated |
The value of data in every row with different types of <column>
:
Type | Value |
---|---|
NODE | Nodes' UUID in the row |
EDGE | Edges' UUID in the row |
ATTR | ATTR's value in the row |
When inputting a column of ATTRs with timestamp type,
table()
records the time value of the 0 time zone for each timestamp in the column, instead of the time value of user's current time zone.
Constant
Example: return 1, "abc", and "2023-01-05 0:0:0" in the table form
return table(1, "abc", "2023-01-05 0:0:0")
Analysis: UQL statement above is equal to return [1, "abc", "2023-01-05 0:0:0"]
Alias (Homologous)
Example: find 10 cards, return their numbers and expiry dates
find().nodes({@card}) as n
limit 10
return table(n._id, n.expire_date)
Function (Homologous)
Example:calculate the neighbor's number of Card CA001, CA002, and CA003
uncollect ["CA001","CA002","CA003"] as n1
khop().src({_id == n1}).depth(1) as n2
group by n1
return table(n1, count(n2))
WITH Alias (Non-homologous)
Example:
uncollect [1,2,3] as a1
uncollect [4,5] as a2
with table(a1, a2) as a3
return a3
RETURN Alias (Non-homologous)
Example:
uncollect [1,2,3] as a1
uncollect [4,5] as a2
return table(a1, a2)