如何将时间纳入图形映射(Neo4j) [英] How to include time into graph mapping (Neo4j)

查看:158
本文介绍了如何将时间纳入图形映射(Neo4j)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个简单的系统来分析人员。我目前使用neo4j来建立用户之间的简单关系。例如,我有一个简单的元组

  mike met sara 

但我怎么能整合时间?例如

  mike met sara 2天前or mike will meet sara in 3 days 

主要原因是因为关系可能在不同时间发生多次。我的目标是能够回答问题:


  • 上周有mike met sara吗?

  • 是mike和sara约会(约会=他们每周至少会见5次)?

  • mike和sara没有见面的最长时间是什么?

  • 麦克有没有个人问题? (可以介绍sara& bill双方具有帮助人们的个性属性的mike met账单,所以可以推定mike在去年没有遇到sara或者账单,但是在上周有X会议,他)



获得这些答案的最佳方法是什么? Neo4j是否是正确的选择?

解决方案

我认为你想要建模的是事件的时间。这些事件(例如会议)是连接到参与者,地点,附加信息等的节点。

然后,您可以选择将事件链接到有序列表中,该列表代表他们的时间顺序,即时间表。

为了快速访问时间线的子部分,您可以创建一个时间树(年 - >月 - >日[ - >小时] - >事件)



请参阅以下具体示例: http://docs.neo4j.org/chunked/milestone/cypher-cookbook-path-tree.html




I'm building a simple system for profiling people. I'm currently using neo4j to build simple relations between users. For example I have simple tuple

mike met sara

But how could I integrate time? For example

mike met sara 2 days ago OR mike will meet sara in 3 days

The main reason is because the relation can happen multiple times at different times. My goal is to be able to answer questions:

  • has mike met sara in last week?
  • are mike and sara dating (dating = they meet at least 5 times a week)?
  • what is the longest period mike and sara did not meet?
  • does mike have personal problems? (we can introduce mike met bill where sara & bill both have personality attribute "helping people". So we can presume if mike didn't met with sara or bill in last year but has X meeting in last week, something is wrong with him)

What is the best way to get these answers? Is Neo4j the right way to go?

解决方案

I think what you want to model is events in time. Those events (e.g. Meeting) are nodes that are connected to the participants, places, additional information etc.

Then you can choose to link the events in a ordered list that represents their chronological order, i.e. a timeline.

For fast access of sub-parts of the timeline you could, create a time-tree (year->month->day[->hour]->event)

See this for a concrete example: http://docs.neo4j.org/chunked/milestone/cypher-cookbook-path-tree.html

这篇关于如何将时间纳入图形映射(Neo4j)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆