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'] ...
随机推荐
- Spring Boot Maven 打包 Jar
Maven pom.xml 必须包含 <packaging>jar</packaging> <build> <plugins> <plugin&g ...
- 使用Js控制ReactRouter路由
[使用Js控制ReactRouter路由] 首先引入PropTypes: const PropTypes = require('prop-types'); 然后定义context的router属性: ...
- java和c#中String
java中: c#中: 1.拼接字符串 sql语句中 in() str="'001','002','003'";至于产生string就这样 str1="'001'&qu ...
- 解题7(FindFirstOnlyOne)
题目描述 找出字符串中第一个只出现一次的字符 输入描述: 输入一个非空字符串 输出描述: 输出第一个只出现一次的字符,如果不存在输出-1 示例1 输入 asdfasdfo 输出 o 代码如下: pac ...
- java.net.UnknownHostException: www.terracotta.org
异常日志: java.net.UnknownHostException: www.terracotta.org at java.net.PlainSocketImpl.connect(PlainSoc ...
- Python 豆瓣日记爬取
无聊写了个豆瓣日记的小爬虫,requests+bs4. cookies_src可填可不填,主要是为了爬取仅自己可见的日记. url填写的是日记页面,即https://www.douban.com/pe ...
- pta l2-4(这是二叉搜索树吗?)
题目链接:https://pintia.cn/problem-sets/994805046380707840/problems/994805070971912192 题意:给定n以及n个整数,问该序列 ...
- javaWEB登录ajax传值
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- Gym - 101243F Vitamins(思维+并查集)
题意 有三种药丸,白色W>红色R>蓝色B,给你m个约束条件,问你n个药丸的颜色,不能确定颜色输出‘?’ 题解 如果1<2<3,只要找到2就能确定1和3的颜色 如果2=4,只要确 ...
- [剑指Offer]9-用两个栈实现队列
题目链接 https://www.nowcoder.com/practice/54275ddae22f475981afa2244dd448c6?tpId=13&tqId=11158&t ...