使用Cypher的graphaware时间范围查询

时间:2016-04-04 13:18:45

标签: neo4j graphaware

我已经安装了graphaware timetree,我试图使用cypher运行范围查询。下面的查询并没有给我最好的表现。你能告诉我这是否正确?

MATCH ps=(n:Event)-[:VISIT_ON]-(m:Minute{value:0})--(h:Hour{value:0})--(d:Day{value:8})--(M:Month{value:2})--(y:Year{value:2016})  
match pe=(n1:Event)-[:VISIT_ON]-(m1:Minute{value:59})--(h1:Hour{value:23})--(d1:Day{value:8})--(M1:Month{value:2})--(y1:Year{value:2016})  
MATCH ph=shortestPath((m)-[:NEXT*]->(m1)) 
WITH nodes(ph) AS minutes
UNWIND minutes as minute 
MATCH (minute)-[:VISIT_ON]->(e:Event) 
.....
return ...

1 个答案:

答案 0 :(得分:0)

在明确添加关系名称后,最后明确表示,它运行得更好..我将它保留在这里供将来参考..:

MATCH ps=(n:Event)-[:VISIT_ON]->(m:Minute{value:0})<-[:CHILD]-(h:Hour{value:0})<-[:CHILD]-(d:Day{value:8})<-[:CHILD]-(M:Month{value:2})<-[:CHILD]-(y:Year{value:2016})  
match pe=(n1:Event)-[:VISIT_ON]->(m1:Minute{value:59})<-[:CHILD]-(h1:Hour{value:23})<-[:CHILD]-(d1:Day{value:8})<-[:CHILD]-(M1:Month{value:2})<-[:CHILD]-(y1:Year{value:2016})  
MATCH ph=shortestPath((m)-[:NEXT*]->(m1)) 
with distinct nodes(ph) as minutes
return size(minutes)