(二)WHERE
//where不单独使用,与match,optional match,start,with搭配
where 与match,optional match 一起用,表示约束
where 与start,with一起用,表示过滤
create(andres:Swedish{name:"Andres",age:36,belt:"white"}),
(peter:Person{name:"Peter",email:"peter_n@example.com",age:34}),
(tobias:Person{name:"Tobias",address:"Sweden/Maimo",age:25}),
(andres)-[:KNOWS{since:1999}]->(peter),
(andres)-[:KNOWS{since:2012}]->(tobias)
1.布尔运算 xor结果不同为true
match(n) where n.name="Peter" XOR
(n.age<30 and n.name="Tobias") OR
NOT(n.name="Tobias" OR n.name="Peter")
return n
2.节点标签过滤
match(n) where n:Swedish return n
3.节点的属性过滤
match(n) where n.age<30 return n
4.关系属性的过滤
match(n)-[k:KNOWS]->(f) where k.since<2000 return f
5.动态节点属性的过滤
//以方括号语法的形式可使用动态计算的值来过滤属性
:param prop:"AGE"
match(n) where n[toLower($prop)]<30 return n
6.属性存在性检查exists
match(n) where exists(n.belt) return n
(二)字符串匹配
//匹配区分大小写
STARTS WITH ,ENDS WITH来匹配字符串的开始或者结尾,如果不关心位置,可以用CONTAINS
1.匹配字符串的开始
match(n) where n.name STARTS WITH "Pet" return n
2.匹配字符串的结尾
match(n) where n.name ENDS WITH "ter" return n
3. 字符串包含
match(n) where n.name CONTAINS "ete" return n
4. 字符串反向匹配
match (n) where NOT n.name STARTS WITH "s" return n
(三)正则表达式
1.正则表达式=~'regexp'
//不区分大小写(?i)多行(?m)单行(?s)
match(n) where n.name=~"(?i)Tob.*" return n
2.正则表达式中的转义字符(包括字符串)
match(n) where n.address=~"Sweden\\/Maimo" return n
(四)在where中使用路径模式
1.模式过滤
//模式返回的是一个路径列表的表达式,列表表达式也是断言,空列表代表false,非空列表代表false
//模式的局限性只能在单条路径中表达,不能像match那样使用逗号分隔多条路径,但可以通过and组合多个模式
match(tobias{name:"Tobias"}),(others)
where others.name in ["Andres","Peter"] AND (tobias)<--(others) return others
2. NOT 过滤
match (persons),(peter{name:"Peter"}) WHERE NOT (persons)-->(peter) return persons
3.模式中的属性过滤
match(n) where (n)-[:KNOWS]-({name:"Tobias"}) return n
4.关系类型的过滤
match(n)-[r]-() where n.name="Andres" AND type(r)=~"K.*" return r
(四)列表 IN
match(a) where a.name in ["Peter","Tobias"] RETURN a
(五)不存在的属性和值
1.属性不存在默认为true
match(n) where n.belt="white" or n.belt is null return n
2.空值过滤
match(person) where person.name="Peter" and person.belt is null return person
(六)属性范围
1.简单范围
match(a) where a.name>="Peter" RETURN a
2.范围组合
match (a) where a.name>"Andres" AND a.name<"Tobias" RETURN a

where_1的更多相关文章

  1. THINKPHP and or 模板语句书写

    select * from xx where (a = 22 or b = 333) or (c=11 and d=22) $where_1['a'] = array('eq', '222'); $w ...

  2. numpy 库使用

    numpy 库简单使用 一.numpy库简介 Python标准库中提供了一个array类型,用于保存数组类型的数据,然而这个类型不支持多维数据,不适合数值运算.作为Python的第三方库numpy便有 ...

  3. numpy 库简单使用

    numpy 库简单使用 一.numpy库简介 Python标准库中提供了一个array类型,用于保存数组类型的数据,然而这个类型不支持多维数据,不适合数值运算.作为Python的第三方库numpy便有 ...

  4. ThinkPHP 中 where条件 or,and 同时使用

    ('a'=1 and 'b'=2) or ('c'=3 and 'd'=4) and 'e'=5 $where_1['a'] = 1; $where_1['b'] = 2; $where_2['c'] ...

随机推荐

  1. pyhton笔记(一):字符编码、变量

    一.什么是python? python是一种面向对象.解释型的计算机语言,它的特点是语法简洁.优雅.简单易学. 编译型语言: 写好代码之后把代码编译成二进制文件,运行时运行编译好的二进制文件.比如C. ...

  2. fiddler常用操作

    fiddler常用操作 标签(空格分隔): fiddler fidrdler抓取https请求: fiddler是一个很好的抓包工具,但是默认的是抓取HTTP的,对于pc的https的会提示网页不安全 ...

  3. python 函数的定义及传参

    函数是一个通用的程序结构部件,是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 定义一个简单的函数: >>> def test(a): #创建一个函数,函数名是test ...

  4. html的textarea默认文案实现换行

    问题:textarea默认文案,想使用换行展示 但是使用/r/n</br>之类的都无效   解决方法: 使用下面字符实现换行   <textarea >第一行内容 第二行内容& ...

  5. 【OpenGL】纹理(Texture)

    纹理是一个2D图片(也有1D和3D),它用来添加物体的细节:这就像有一张绘有砖块的图片贴到你的3D的房子上,你的房子看起来就有了一个砖墙.因为我们可以在一张图片上插入足够多的细节,这样物体就会拥有很多 ...

  6. Android开发之getX,getRawX,getWidth,getTranslationX等的区别

    转载请注明出处:http://blog.csdn.net/dmk877/article/details/51550031      好久没写博客了,最近工作确实挺忙的,刚刚结束了一个TV项目的开发,对 ...

  7. centos 7 redis-4.0.11 哨兵

    redis-master:192.168.199.223 redis-slave_1: 192.168.199.224 redis-slave_2: 192.168.199.252 redis-mas ...

  8. Vue.Draggable:基于 Sortable.js 的 Vue 拖拽组件使用中遇到的问题

    Sortable.js 介绍 https://segmentfault.com/a/1190000008209715 项目中遇到的问题: A - 我需要在项目的拖拽组件中,使用背景 1 - 想到的第一 ...

  9. 如何解决make: Nothing to be done for `all' 的方法

    正常情况下,当文件没有更新且已经编译过时,再次make就会报这个错误,表示文件未更新,不需要编译. 如果异常情况没有检测到更新文件,或者想要强制重新编译,只需要make clean,再次编译即可.

  10. Codeforces Beta Round #22 (Div. 2 Only)

    Codeforces Beta Round #22 (Div. 2 Only) http://codeforces.com/contest/22 A 水题 #include<bits/stdc+ ...