Mig56
Mig56

Reputation: 131

Neo4J/Graph database modeling user devices

I'm attempting to use Neo4J to model user mobile devices. However, I'm a complete newbie with graph databases and I'm a little confused on how to make the connections.

For example:

  1. UserA
    • Device 1, OS 1, Carrier 1
    • Device 2, OS 2, Carrier 2
  2. UserB
    • Device 1, OS 2, Carrier 2
    • Device 2, OS 1, Carrier 1
  3. UserC
    • Device 3, OS 3, Carrier 1
    • Device 2, OS 3, Carrier 1

I need to be able to query the following information rapidly:

What is confusing me is that I want to connect users with the same device together (ie: Device 1), however, the devices are slightly different (ie: carriers). If I attempt to use the same node, I will lose the information on which path is for which user.

What is the best practice when modeling a graph database? Should I just create different device nodes for different device configurations? Is it bad practice having multiple "Device 1" nodes?

Thanks in advance...

Upvotes: 0

Views: 246

Answers (1)

Eddie Dickey
Eddie Dickey

Reputation: 72

I'm a newbie as well, but the best thing to do is to start. This book is a great resource for best practices.

I think that you could have different device nodes with properties such as 'os:os1'. And these devices would have a relationship to a carrier node.

For example: (A) --owns--> (Device 1 os:os1) --uses--> (Carrier1)

Each device would be its own node. Best thing is to play around with it. A good resource for this is to use the cypher console. You can test ideas and share them.

Hope this helps

Upvotes: 1

Related Questions