Parameters, Value
Count operation can count the number of nodes, edges, paths, property values or schemas, as long as it is a column of elmements, the quantity can be counted by count()
.
Syntax:
- Format: count(
<column>
) - Parameters: see table below
- Value: ATTR (numbers)
Name | Category | Specification | Description |
---|---|---|---|
<column> |
NODE,EDGE,PATH,ATTR,ARRAY,TABLE | / | The column to be aggregated |
The value of <column>
with different categories in every row:
Type | Value |
---|---|
NODE | Node's UUID in the row |
EDGE | Edge's UUID in the row |
PATH | ROW INDEX(starts from 0)in the row |
ATTR | ATTR's value in the row |
ARRAY | The value of the 1st element in the array of the row |
TABLE | ROW INDEX(starts from 0)in the row |
ATTR
Example: deduplicate the elements in an array, count the number of the elements after deduplication
uncollect [1,2,4,5,2,1,3] as a
with distinct(a) as b
return count(b)
Node
Example: find @device
nodes, count the number of them
find().nodes({@device}) as n
return count(n)
Edge
Example: find @view
edges, count the number of it
find().edges({@view}) as e
return count(e)
Path
Example: find the shortest paths from Card CA001 to CA002 within 5 steps, count the number of the paths
n({_id == "CA001"}).e()[*:5].n({_id == "CA002"}) as p
return count(p)