Hello, and thank you for your impressive work. I searched for graph DBs a few months ago and missed (!!) dGraph, now I found it I’m really excited to begin working with it.
In my current project I’d like to model something that seems to require ternary relationships, but maybe there is another way to do it.
My data structure is similar to the following gambling system:
sport teams play games
gamblers bet on who wins and with what score
Example:
Team A et team B will play together.
Gamblers G1 and G2 make their bet:
G1 bets A will beat B with a score of 3
G2 bets B will bet A with a score of 1
My hypothetical graph would have nodes for gamblers and teams, and edges like:
“beats with score N”
“bet on a team couple, a winner and a score” → an edge pointing to an edge?
As dGraph doesn’t have ternary relationships, my only idea is to duplicate team nodes: Each time a gambler makes a bet on 2 teams, I duplicate the 2 teams nodes and link the duplicates to the player. Then I can easily link those duplicates with the player’s bet.
The exact modelling of your data would primarily depend on what kind of queries do you want to perform.
Regarding duplicates, I think there is some confusion. In Dgraph, you don’t have to create any duplicates. You just have to create an edge to an already existing node.
I’ll try and explain using an example. This might not be the exact structure that you want to use.
Here, when we add the teams for the bet, b1 we aren’t creating any copies. We just link the teams so that we could traverse them. Is this what you meant?