nebula-graph

How to add list type properties to vertices in the NebulaGraph database?


We are testing NebulaGraph database on AWS and need to add dynamic vertex properties. For example, a Person vertex may have purchased a product many times, how to add a list time orderTime property, and every time the person purchases the product, a timestamp or time string is pushed into this list type property?

Finally we get (v:Person{orderTime:[1672898563,1672897563,1672896563]}).


Solution

  • Normally, if the purchase event is an edge/relationship between two vertices, and it’s multi-to-multi, it’s a tyical case we should use the rank of the edge as the timestamp. In NebulaGraph, there is no “id” or Key for an edge, instead, a 4-tuple defined one instance of edge, refer to here for details.

    While, if in the case the purchase should be considerred as a “property” for a vertex under TAG: Person, we could leverage the self-loop edge to enable the list of orderTime property, see more from here for details.

    Besically, the two approaches share similar ideas under the hood, just for second one, the source and target vertices are the same.