where_1
(二)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的更多相关文章
- 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 ...
- numpy 库使用
numpy 库简单使用 一.numpy库简介 Python标准库中提供了一个array类型,用于保存数组类型的数据,然而这个类型不支持多维数据,不适合数值运算.作为Python的第三方库numpy便有 ...
- numpy 库简单使用
numpy 库简单使用 一.numpy库简介 Python标准库中提供了一个array类型,用于保存数组类型的数据,然而这个类型不支持多维数据,不适合数值运算.作为Python的第三方库numpy便有 ...
- 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'] ...
随机推荐
- Linux切换工作目录命令:cd
cd [语法]cd[目录路径][详解]cd指令用于在不同目录间进行切换,前提下该帐号要有这个目录的权限.如果直接输入cd,并省略目录名,则会自动切换到用户根目录下.[参数] 选项 相应功能 目录路径 ...
- MVC003之调用BLL层方法(BLL层调用了WebService)
项目又BLL类库,在类库中引用了webservice.在web层调用BLL的方法时 错误如下: 在 ServiceModel 客户端配置部分中,找不到引用协定“OAService.IntranetSe ...
- 判断python字典中key是否存在
- Cisco N3K VPC+HSRP+ospf 配置
VPC概念 VPC:vpc是指vpc对等体设备和下游设备之间的组合PortChannel. vpc对等交换:就是组成vpc功能的两个nexus系列交换机,一个设备为主,一个为备. vpc对等连接:用于 ...
- 【go】http实验
实验1:上手篇 package main import ( "net/http" //"fmt" "os" ) func proxyFunc ...
- TZOJ 3315 买火车票(线段树区间最小值)
描述 Byteotian州铁道部决定赶上时代,为此他们引进了城市联网.假设城市联网顺次连接着n 个市从1 到n 编号(起始城市编号为1,终止城市编号为n).每辆火车有m个座位且在任何两个运送更多的乘客 ...
- [剑指Offer]53-在排序数组中查找数字(二分查找)
题目一 数字在排序数组中出现的个数 题目描述 统计一个数字在排序数组中出现的次数. 解决思路 写两个二分查找分别找第一个和最后一个该数字,然后可直接出计算有几个该数字.时间复杂度为O(logn). 这 ...
- Springboot学习03-SpringMVC自动配置
Springboot学习03-SpringMVC自动配置 前言 在SpringBoot官网对于SpringMVCde 自动配置介绍 1-原文介绍如下: Spring MVC Auto-configur ...
- xadmin系列之单实例模式
先看下单实例的定义 python的模块实现单例模式是python语言特有的,python的模块天然就是单例的,因为python有个pyc文件,导入一次后,第二次导入直接从pyc中取数据了 这里我们主要 ...
- java ATM模拟程序
//基本功能已经完善,文件读取没有问题,文件重写尚未完成. Account类 public class Account { //初始化参数 private String accountID; priv ...