比较运算
运算函数 | 简介 |
---|---|
a.eq(b) | a==b? |
a.neq(b) | a!=b? |
a.lt(b) | a<b? |
a.lte(b) | a<=b? |
a.gt(b) | a>b? |
a.gte(b) | a>=b? |
a.inside(low,high) | low<a<high? |
a.outside(low,high) | a>high或a<low? |
a.between(low,high) | low<=a<high? |
a.within(…) | a in … ? |
a.without(…) | a not in … ? |
逻辑运算
运算函数 | 简介 |
---|---|
is() | 判断是 |
not() | 判断不是 |
and() | 与 |
or() | 或 |
统计运算
运算函数 | 简介 |
---|---|
sum() | 求和 |
max() | 最大值 |
min() | 最小值 |
mean() | 平均值 |
数学运算
- math()函数
- 内置了众多数学运算函数,可以使用math(string)的方式进行调用
- 其中,“_”符号可以用作充当string中的一个变量,表示传进迭代器中的值
- 例如:
g.V("1:abc@qq.com").out().math("log(_)")
变量的定义与使用
命令 | 效果 |
---|---|
g.V('2:100').as('a').out('created').in('created').as('b').where('a',neq('b')) | 找到100的伙伴节点 |
g.V('2:100').as('a').out().as('b').out().as('c').select('a', 'c') | 从路径中选取第1步和第3步的结果作为最终结果 |
g.V('2:100').as("a").repeat(out().as("a")).times(2).select(last, "a") | 从路径中选择最后一步的结果作为最终结果 |
g.V('2:100').as('a').out().as('b').out().as('c') .where('a', eq('c')).by('name').select('a', 'b', 'c').by(id) | 选取满足第1步和第3步name属性相等的路径 |