小编Lis*_*ter的帖子

标签名称上的Neo4j 2.0通配符搜索

在Cypher中处理属性时,可以使用正则表达式来匹配属性值,如下所示:

Match (n)-[:IS_A]-() where (n:Course_Driving_001) and (n.name =~ '(?i).*criteria.*' or n.description =~ '(?i).*criteria.*')   return distinct n limit 20;
Run Code Online (Sandbox Code Playgroud)

我想用标签名称做同样的事情.我想获得包含特定字符串的所有唯一标签.就像是:

 Match (n)-[:IS_A]-() where (n:Course_*_001) return distinct n;
Run Code Online (Sandbox Code Playgroud)

这可以做到Cypher吗?还是RestAPI?常用表达?

我正在使用Neo4j 2.0 Release.

regex wildcard neo4j cypher

5
推荐指数
1
解决办法
2630
查看次数

Neo4j匹配节点属性或关系属性

我正在尝试编写一个返回与节点属性或关系属性匹配的节点的查询.

例如,如果关系属性状态为"good",我想要name属性为George OR的所有节点.我有两个查询将获取每个节点:

MATCH (n) where n.name = 'George' return n

MATCH (n)-[r]-() where r.status = 'good' return n 
Run Code Online (Sandbox Code Playgroud)

我可以编写一个简单的查询来获得这些组合结果吗?我以为我可以使用这个可选查询(下面),但我似乎误解了可选的匹配子句,因为我只从第一个查询中获取节点.

MATCH (n) where n.name = 'George' 
Optional MATCH (n)-[r]-() where r.status = 'good' return distinct n 
Run Code Online (Sandbox Code Playgroud)

properties match relationship neo4j cypher

1
推荐指数
1
解决办法
7112
查看次数

标签 统计

cypher ×2

neo4j ×2

match ×1

properties ×1

regex ×1

relationship ×1

wildcard ×1