标量函数

//返回一个单值

 

(1)size
//返回列表中元素的个数
return size(["Alice","Bob"])as col------------2
//返回模式表达式子图的个数
match(a)where a.name="Alice" return size((a)-->()-->()) as fof--------3
(2)length
//返回路径的长度
match p=(a)-->(b)-->(c)where a.name="Alice" return length(p)------3
//返回字符串的长度
match(a)where length(a.name)>6 return length(a.name)--------------7
(3)返回关系类型
match(n)-[r]->()where n.name="Alice" return type(r)
(4)返回关系或节点的id
match(a)return id(a)
(5)返回表达式列表中第一个非空的值,如果都为空,则返回Null
match(a) where a.name="Alice" return coalesce(a.name,a.eyes)------Alice
match(a) where a.name="Alice" return coalesce(a.hairColor,a.eyes)----brown
match(a) where a.name="Alice" return coalesce(a.hairColor,a.hobby)----null
(6)返回列表中的第一个元素
match(a) where a.name="Eskil" return head(a.array) ------------one
(7)返回列表中的最后一个元素
match(a) where a.name="Eskil" return last(a.array)--------three
(8)返回时间戳(毫秒)
return timestamp()-----1547990097138
(9)返回关系的开始节点
match(x:Person{name:"Alice"})-[r]->() return startNode(r)
(10)返回关系的结束节点
match(x:Person{name:"Alice"})-[r]->() return endNode(r)
(11)返回节点或关系的属性值
create(p:Person{name:"Qiao",age:18})return properties(p)
(12)转化为整数
return toInt("42"),toInt("number")---42,null
(13)转化为浮点数
return toFloat("11.5"),toFloat("number")----11.5,null

posted on 2019-01-20 21:26  happygril3  阅读(242)  评论(0编辑  收藏  举报

导航