I am new to dgraph so forgive me if i am asking a dumb question. I have a realtime use case (lets say a chat application) and as the conversation is happening, i would like to update the conversation with new turns (utterances). These turns will need to be related to the parent conversation.
Will I need to update the conversation object for every turn in this case? or do i just insert the turn and then create the edge between the conversation and turn?
No question is dumb, dumb is not making any.
What do you mean by update a conversation? Do you mean edit the content?
It is not clear if you question is related to “How Dgraph would handle realtime writes” or if you are requesting suggestion in your datamodeling.
A chat in Graph has several ways to do it. The approach you take that will tell you whether you will need to do this or not.
Approach 1: Each sentence is a node with the predicates “body, date of creation, owner and others”. That is, you will build the conversation using the create_at timestamp
Approach 2: Each sentence is a node with the same predicates as before, but they are connected directly by a “wire”. An edge that denotes a linked list. That way you will not depend on the Timestamp. But there can be errors when the conversation goes REALLY fast. However, to expand this conversation with recurse it would be fast. Cuz it would be just following edges.
Perhaps my answer is not in line with your question, as I may not have understood it correctly.
Thanks @MichelDiz that helps
I think you were meaning “realtime reads”. For graphql with subscriptions that would be easy (check this out: Build a chat app with GraphQL Subscriptions & TypeScript: Part 1 - DEV Community ), but for DQL there are no subscriptions AFAIK, so going with graphql subscriptions (which is supported by dgraph) would be the easier way.