[英]How to implement lookup/reference data in apache tinkerpop gremlin or graph database?
How to implement lookup/reference
data in a gremlin or graph database
?如何在gremlin or graph database
中实现lookup/reference
数据?
I need to collect all types of identification
,我需要收集所有类型的identification
,
1. Diving license,
2. Social security number,
3....
For UI, I need to send the "identification_type"
list (above list).对于 UI,我需要发送"identification_type"
列表(上方列表)。
& &
What is the best way to implement this?实现这个的最佳方法是什么? Create an edge
b/w type and actual value?创建edge
黑白类型和实际值? or type as a property
?或类型作为property
?
The model mostly depends on your required queries. model 主要取决于您所需的查询。 Will you be looking at persons who share the same SSN or driving license (Lots of fraud detection work that way), then use an edge to a node with a value.您是否会查看共享相同 SSN 或驾驶执照的人(很多欺诈检测都是这样工作的),然后使用边缘到具有值的节点。 If you don't care about users who have the same identification values, then simply use node properties.如果您不关心具有相同标识值的用户,那么只需使用节点属性即可。
As Tomaž Bratanič had answered , graph modeling depends on your needs(pattern of querying).正如 Tomaž Bratanič回答的那样,图形建模取决于您的需求(查询模式)。
For example, tradeoff in detail:例如,详细权衡:
Putting the SSN as a node/vertex will make the query pattern: Find vertices/nodes with certain SSN
easier as underlying it's a native graph query, where you are doing graph walk/traverse from a starting vertex/node.将 SSN 作为节点/顶点将使查询模式成为可能: Find vertices/nodes with certain SSN
更容易,因为它是本机图形查询的基础,您正在从起始顶点/节点进行图形遍历/遍历。
Instead, putting SSN into different types of nodes/vertices(different labels/tags) as a property will make that query more costly in a graph database, where, it will scan nodes/vertices' properties(and if we index/make an ordered duplicated data for this to accelerate such query pattern, the writing path will be more costly comparing).相反,将 SSN 作为属性放入不同类型的节点/顶点(不同的标签/标签)将使该查询在图形数据库中的成本更高,它将扫描节点/顶点的属性(如果我们索引/制作一个有序的重复数据为此加速此类查询模式,写入路径将比较昂贵)。 The PRO of this property approach
will make the query pattern/partial query pattern of Fetch node/vertex properties
less costly.这种property approach
的 PRO 将使Fetch node/vertex properties
的查询模式/部分查询模式的成本更低。
One experience I also could share when designing the graph model is, to do it following your intuition(as graph model is intuitive).在设计图表 model 时,我也可以分享一个经验,就是按照你的直觉去做(因为图表 model 很直观)。 Revisit/revise it when your system involves.当您的系统涉及时,重新访问/修改它。
Also, put some ref from Nebula Graph, the project I am working on;)另外,放一些来自 Nebula Graph 的参考,这是我正在从事的项目;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.