raf
raf

Reputation: 147

Neo4: I need a help to model my data in the more correct way

I have a database formed by data that I need to duplicate because they belong to two different fields, that is, they belong both to the Pluto field and part of the Database also belongs to the Goofy field. What is the most correct solution to model my DB?

Create a multilabel to which each node adds the label :Pluto or :Goofy? Or create an attribute for each scope field = Pluto or field = Goofy?

Upvotes: 0

Views: 37

Answers (2)

cybersam
cybersam

Reputation: 66999

If your data contains only a handful of alternative values (e.g., just Pluto and Goofy) for the same concept (e.g., "Disney Character"), then using a separate label for each value is the simplest way to model the data.

However, if you need to represent numerous alternative values for the same concept, then it would probably be simpler to just use a single label (say, DisneyCharacter), and put the alternative values in a property (say, name). To quickly kick off queries for a specific alternative value, you can create an index for such nodes (e.g., CREATE INDEX ON DisneyCharacter(name)) -- so, this approach can be just as fast as using separate labels.

Upvotes: 1

ThirstForKnowledge
ThirstForKnowledge

Reputation: 1284

Both of your procedures would work. However, the multi label approach is preferable for performance reasons. In addition, the queries for this are much simpler and clearer.

Upvotes: 0

Related Questions