0

How to implement lookup/reference data in a gremlin or graph database?

I need to collect all types of identification,

1. Diving license,
2. Social security number,
3....

For UI, I need to send the "identification_type" list (above list).

&

What is the best way to implement this? Create an edge b/w type and actual value? or type as a property?

Thirumal
  • 8,280
  • 11
  • 53
  • 103

2 Answers2

1

The model mostly depends on your required queries. 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. If you don't care about users who have the same identification values, then simply use node properties.

Tomaž Bratanič
  • 6,319
  • 2
  • 18
  • 31
0

As Tomaž Bratanič had answered, graph modeling depends on your needs(pattern of querying).

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.

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). The PRO of this property approach will make the query pattern/partial query pattern of Fetch node/vertex properties less costly.

One experience I also could share when designing the graph model is, to do it following your intuition(as graph model is intuitive). Revisit/revise it when your system involves.

Also, put some ref from Nebula Graph, the project I am working on ;)

Wey Gu
  • 575
  • 1
  • 6
  • 11