Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Neo4j:如何使用datetime属性range to语句查询最后15分钟?_Neo4j_Cypher - Fatal编程技术网

Neo4j:如何使用datetime属性range to语句查询最后15分钟?

Neo4j:如何使用datetime属性range to语句查询最后15分钟?,neo4j,cypher,Neo4j,Cypher,我正在处理电子邮件数据,希望使用现有查询并添加到其中。我想在过去15分钟内添加和where lastseen(存储为DateTime),而不在cypher语句中键入完整的DateTime范围。类似于(lastseen-(datetime()-15MM)) 以下是示例发送方节点属性: <id>:12662 domain:corp.com firstseen:"2020-01-14T06:02:33Z" lastseen:"2020-01-14T06:25:45Z" name:pe

我正在处理电子邮件数据,希望使用现有查询并添加到其中。我想在过去15分钟内添加
和where lastseen(存储为DateTime)
,而不在cypher语句中键入完整的DateTime范围。类似于(lastseen-(datetime()-15MM))

以下是示例
发送方
节点属性:

<id>:12662  domain:corp.com  firstseen:"2020-01-14T06:02:33Z"  lastseen:"2020-01-14T06:25:45Z" name:person@corp.com  timesseen:300

您可以使用
持续时间
功能获取您的范围

持续时间掩码
PT900S
为900秒

WITH datetime() AS end 
WITH end, end - duration("PT900S") AS start
RETURN start, end, duration.between(end, start)
在您的查询中,它可能看起来像这样

MATCH path = (s:Sender)-->(a:Attachment)-->(:Recipient)
WHERE datetime() - duration("PT900S") <= s.lastseen <= datetime()
WITH s, COUNT(DISTINCT a) AS cnt, COLLECT(path) AS paths
WHERE cnt >= 2
RETURN paths
MATCH path=(s:Sender)-->(a:Attachment)-->(:Recipient)

其中datetime()-持续时间(“PT900S”)非常棒。谢谢@Dave Bennett在哪里可以找到关于PT900S部件的更多信息。我可以看到它是900秒,但是有关于这个的文档吗@戴夫·班尼你敢打赌-
MATCH path = (s:Sender)-->(a:Attachment)-->(:Recipient)
WHERE datetime() - duration("PT900S") <= s.lastseen <= datetime()
WITH s, COUNT(DISTINCT a) AS cnt, COLLECT(path) AS paths
WHERE cnt >= 2
RETURN paths