如何使用Neo4j存储位置和时间戳数据 [英] how to store location and time stamp data using Neo4j
问题描述
如何使用Neo4j存储每2分钟在不同路线上的公交车生成的位置和时间戳数据.
路线1:
A-> B-> C-> D-> C-> B-> A [在neo4j中创建的路由]如何实现以下时间戳存储?
8:01 8:10 8:25 9:10 9:xx xxx xxx
x:x xx:xx xx:xx xx:x x:x X:X
路线2:
G-> G-> H-> I-> J-> K-> L
10:01 10:10 10:25 11:10 12:xx xxx
x:x xx:xx xx:xx xx:x x:x X:X
在rdbms中,我将每个Bustop的时间存储为列ID.如何做到这一点.卡在我的大学项目中,任何帮助将不胜感激.
要创建一个好的数据模型,您必须想知道要在数据中寻找什么.
在这里,您将寻找时间戳(或至少HH:mm数据)以了解公交车何时到达站点.
因此,您将需要两个节点:
:Bus
id: integer (Unique id for the bus)
route: integer (I suppose you have bus numbers)
:Stop
id: integer (unique id for the stop)
location: string (I don't know if you have the GPS coordinates, but you can store them using a string)
name: string (your stops are having a name I guess)
和一种关系:
:REACHED
date: timestamp
示例模型(从neo4j Web界面提取PNG)
因此,当公交车到达站点时,您只需使用timestamp()
neo4j方法在公交车节点与他刚刚到达的站点之间创建一个关系,即可生成创建关系的确切时间戳./p>
然后,要匹配公共汽车的每个停靠站,您可以从REACHED
关系中提取时间戳记值.
how to store location and time stamp data generated by the buses every 2 minutes on different routes using Neo4j.
Route 1 :
A-> B-> C-> D-> C-> B-> A [route created in neo4j] how to achieve below time-stamp storing?
8:01 8:10 8:25 9:10 9:xx xxx xxx
x:x xx:xx xx:xx xx:x x:x X:X
Route 2:
G-> G-> H-> I-> J-> K-> L
10:01 10:10 10:25 11:10 12:xx xxx
x:x xx:xx xx:xx xx:x x:x X:X
In rdbms, i store the time with each bustop as column id. How to do this neo4j. Stuck with my college project, any help would be appreciated.
To create a good data model, you have to wonder what you will be looking for in your datas.
Here, you will be looking for a timestamp (or at least an HH:mm data) to know when a bus will reach a stop.
So, you will need two nodes:
:Bus
id: integer (Unique id for the bus)
route: integer (I suppose you have bus numbers)
:Stop
id: integer (unique id for the stop)
location: string (I don't know if you have the GPS coordinates, but you can store them using a string)
name: string (your stops are having a name I guess)
And one relationship:
:REACHED
date: timestamp
Example model (PNG extracted from neo4j web interface)
So, when a bus reaches a stop, you simply have to create one relation between your bus node and the stop node he just reached, using timestamp()
neo4j method to generate the exact timestamp of the creation of your relation.
Then, to match every stop of a bus, you can extract the timestamp value from REACHED
relationship.
这篇关于如何使用Neo4j存储位置和时间戳数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!