alternative relationship deprecated warning

我与影子孤独终老i 提交于 2019-12-11 02:08:49

问题


Cypher query:

MATCH (x) WHERE x.uuid = "41f64ab1-6009-4e95-b22b-c833525f6edb" MATCH p = 
(o)-[:CONTAINS|:HAVING*]->(x) WHERE labels(o) IN ['Box', 'Package'] RETURN p

Running it in Neo4j browser results in a warning:

**WARNING: This feature is deprecated and will be removed in future versions.**

The semantics of using colon in the separation of alternative relationship 
types in conjunction with the use of variable binding, inlined property 
predicates, or variable length will change in a future version.

How can I re-write this query to eliminate this warning?

Thanks in advance.


回答1:


This deprecation is not about inability of using relationship type alternatives but about its syntax – see cypher deprecations in version 3.2. Only first type has colon now, i.e. not :R1|:R2 but :R1|R2. Deprecation warning in Neo4j browser suggests that former syntax will have new semantics in the future.

Specifying relationship type in a pattern is actually much more effective than filtering paths ex-post which is the way that the workaround by Tom Geudens is executed.




回答2:


This might do it :

MATCH (x) WHERE x.uuid = "41f64ab1-6009-4e95-b22b-c833525f6edb"
MATCH p = (o)-[*]->(x) 
WHERE labels(o) IN ['Box', 'Package']
AND ALL (rs IN relationships(p) WHERE type(rs) IN ['CONTAINS','HAVING'])
RETURN p

Hope this helps.

Regards, Tom



来源:https://stackoverflow.com/questions/45790779/alternative-relationship-deprecated-warning

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!