Can new Edges be added to large numbers of existing Nodes by referencing a Node's Type?

I tend to think of edges as attributes when data modeling. But I don’t think your definition is wrong, just another perspective.

One interesting aspect of GraphQL SDL in this case is the interface construct. In the case above, you could have a Person interface type, of which Director (and Actor, etc) could derive. In the Movie type, the directors edge could be defined as an array of Person (directors [Person]). This would allow you to add any Person as a director. However, that might not be a good idea if the Director derived type has attributes (edges) that are needed by the application. In that case, better to declare directors [Director]. dgraph GraphQL mutations will ‘type check’ supplied values in that case and enforce only Director types.

If you haven’t read the GraphQL spec on interfaces and derived types: https://graphql.org/learn/schema/#interfaces

1 Like