简体   繁体   English

如何使用历史数据[ArangoDB]

[英]How to work with historical data [ArangoDB]

Can you explain how to work with historical data in ArangoDB? 你能解释一下如何处理ArangoDB中的历史数据吗?

For example, i have 5 collection: 例如,我有5个集合:

1. School [Type = Documents] - I keep information about schools. I have 2 school:
- BestSchool
- NotveryBestSchool
2. Class [Type = Documents] - I keep information about class. I have 4 class:
- Best A Class
- Best B Class
- NotveryBest A Class
- NotveryBest B Class
3. Students [Type = Documents] - I keep information about Students:
- Timmi
- Lisa
- Kail
- Bart
4. ClassinSchool [Type = Edge] - I keep information about class in school, where "parents" = "school" and "child" = Class:
_From: School/BestSchool _To: Class/Best A Class
_From: School/BestSchool _To: Class/Best B Class
_From: School/NotveryBestSchool: Class/NotveryBest A Class
_From: School/NotveryBestSchool: Class/NotveryBest B Class
And, finally:
5. StudentsinClass [Type = Edge] -  I keep information about Students in Class, where "parents" = "Students" and "Child" = Class
_From: Students/Timmi _To: Class/Best A Class
_From: Students/Lisa _To: Class/Best B Class
_From: Students/Kail: Class/NotveryBest A Class
_From: Students/Bart: Class/NotveryBest B Class

And here is the case. 情况就是这样。 2017 Bart studied very well. 2017巴特学得很好。 At the end of the year he was transferred from "NotveryBest B Class" to a new class "NotveryBest A Class". 在年底,他从“NotveryBest B Class”转到了新的“NotveryBest A Class”课程。 In 2018, he studied even better and his parents decided to transfer him to another school, where he could develop his talents. 在2018年,他学习得更好,他的父母决定将他转到另一所学校,在那里他可以发展自己的才能。 He was transferred from "NotveryBestSchool" to a new school "BestSchool" and class "Best B Class". 他从“NotveryBestSchool”转到了新学校“BestSchool”和“Best B Class”。

Assumption : Do I understand correctly, in order to track Bart's movement between classes and schools I must add dates to the edge? 假设 :我是否理解正确,为了跟踪巴特在班级和学校之间的运动,我必须添加日期到边缘? The main fields in this edges should be StartDates and EndDates? 这边的主要字段应该是StartDates和EndDates? Or maybe his movement I need to store in the parameters of the Bart? 或许他的运动我需要存储在Bart的参数中? And the third option - to make a separate collection "History" and store everything there. 第三种选择 - 单独收集“历史”并将所有内容存储在那里。

Which option to choose? 选择哪个选项?

So here is the way I see it: 所以这就是我看到它的方式:

  • Quick and dirty: Put everything in a history collection. 快速而肮脏:将所有内容放入历史记录集合中。 This is easy to do and you can put a GUI on top of this table in no time. 这很容易做到,您可以立即在此表的顶部放置GUI。 However, trying to do analysis on this table in the future will be messy because the multiple joins that will be involved to get usable time based data. 但是,尝试在将来对此表进行分析将是混乱的,因为将涉及获得可用的基于时间的数据的多个连接。 Also, if you have a lot of students, this table could grow quite a bit. 此外,如果你有很多学生,这个表可能会增长很多。

  • Student centric: Storing the information in the student object as a property will work well if we have a lot of students and we usually retrieve historical information on a student per student basis most of the time. 以学生为中心:如果我们有很多学生,将学生对象中的信息作为财产存储将很有效,并且我们通常会在大多数时间内检查每个学生的历史信息。 Doing analysis on the aggregated student body to find patterns will be a bit complex as we will need to get the data from individual students before we can analyze it. 对聚合的学生团体进行分析以找到模式将会有点复杂,因为在我们分析之前我们需要从个别学生那里获取数据。

  • Adding dates to edges: This takes a bit more effort to setup initially, but it is the most flexible way to store the data. 向边添加日期:最初设置需要花费更多精力,但这是存储数据的最灵活方式。 Plus you could add additional information like reason for the transfer for example. 另外,您可以添加其他信息,例如传输原因。 This setup will allow you to do the most analysis on student transfer patterns or timing of student transfers etc... 此设置将允许您对学生转学模式或学生转学时间等进行最多分析......

In the end it all depends on what you are building, but I tend to gravitate toward the third option unless I have specific reasons not to do it that way. 最后,这一切都取决于你正在建设什么,但我倾向于倾向于第三种选择,除非我有特定的理由不这样做。

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

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