简体   繁体   English

OrientDB时间序列数据

[英]OrientDB Time Series Data

I have seen the example of using OrientDB to model time series data but I don't know what the insertion looks like. 我已经看到使用OrientDB建模时间序列数据的例子,但我不知道插入是什么样的。

It would be great if somebody had an example for this. 如果有人有这方面的例子会很棒。

Regards, Tom 问候,汤姆

https://github.com/orientechnologies/orientdb/wiki/Time-series-use-case https://github.com/orientechnologies/orientdb/wiki/Time-series-use-case

to get a clearer idea of the utility of the Time Series, you could imagine this casuistry: 为了更清楚地了解时间序列的效用,你可以想象这个诡计:

You have a given log related to a certain date. 您有一个与特定日期相关的给定日志。 In the case where the DB had millions of records, a search through the date field would be very expensive as it would force the query to read all the records and check the condition, while with the time series filtering takes place at each passage between connected classes ( years, months, hours and then logs), so after going to read only the records that match the date and not all the others. 在数据库有数百万条记录的情况下,搜索日期字段将非常昂贵,因为它会强制查询读取所有记录并检查条件,而时间序列过滤发生在连接之间的每个通道类(年,月,小时,然后是日志),所以在读取与日期匹配的记录而不是所有其他记录之后。

Following a small example: 举个小例子:

CREATE CLASS Year extends V
CREATE CLASS Month extends V
CREATE CLASS Day extends V
CREATE CLASS Hour extends V
CREATE CLASS Log extends V

CREATE PROPERTY Year.value STRING
CREATE PROPERTY Year.month LINKMAP Month
CREATE PROPERTY Month.day LINKMAP Day
CREATE PROPERTY Day.hour LINKMAP Hour
CREATE PROPERTY Hour.log LINKSET Log

CREATE VERTEX Log SET priority='high'
CREATE VERTEX Log SET priority='medium'
CREATE VERTEX Log SET priority='low'

INSERT INTO Hour(log) VALUES ([#16:0,#16:1])
INSERT INTO Hour(log) VALUES ([#16:2])
INSERT INTO Day(hour) VALUES ({'15':#15:0})
INSERT INTO Day(hour) VALUES ({'10':#15:1})
INSERT INTO Month(day) VALUES ({'4':#14:0})
INSERT INTO Month(day) VALUES ({'21':#14:1})
INSERT INTO Year(value,month) VALUES ('2012',{'3':#13:0})
INSERT INTO Year(value,month) VALUES ('2015',{'8':#13:1})

Query 1 : Find all the logs related to the date 4/3/2012 h15 查询1 :查找与日期4/3/2012 h15相关的所有日志

SELECT EXPAND(month[3].day[4].hour[15].log) FROM Year WHERE value='2012'

Query 2 : Find all the logs related to the date 21/8/2015 h10 查询2 :查找与日期21/8/2015 h10相关的所有日志

SELECT EXPAND(month[8].day[21].hour[10].log) FROM Year WHERE value='2015'

Hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM