I'm using NEO4J 3.0 and it seems that HAS function was removed. Type of myrelationship is a date and I'm looking to retrieve all relation between two dates such as my property "a" is greater than certain value.
How can I test this using NEO4j Thank you
[EDITED to add info from comments]
I have tried this:
MATCH p=(n:origin)-[r]->()
WHERE r>'2015-01'
RETURN AVG(r.amount) as totalamout;
I created relationship per date and each one has a property, amount
, and I am looking to compute the average amount for certain period. As example, average amount since 2015-04.
答案 0 :(得分:1)
要回答第一句话引发的问题:在neo4j 3.x中,HAS()
函数已替换为EXISTS()
。
[更新1]
此版本的查询应该有效:
MATCH p=(n:origin)-[r]->()
WHERE TYPE(r) > '2015-01'
RETURN AVG(r.amount) as totalamout;
但是,根据日期为您的关系提供不同的类型是一个坏主意。最好只使用date
属性。
[更新2]
如果您更改了数据模型以向您的关系添加date
属性(我将向其提供类型FOO
),则以下查询将找到每{{1}的平均数量p
在date
之后的所有关系(假设您的所有日期都遵循相同的严格2015-01
模式):
YYYY-MM