Edge ID between 2 nodes

mutation

(Darius) #1

Hey guys, another question, for some reason, I cannot find any materials online. Most of dgraph example that I have encountered so far has been a one-time relationship between two nodes, such as [friend] or [work_at], [directed], etc. What I want to try is multiple edges of the same relationship between 2 nodes, such as edges between a user and a website ie [visited]. A user can visit the same website multiple times, but the predicate like visited_time will be different.

I tried using facet to add edge attribute, but when I add the same edge with a different attribute, say the visited_time, it replaces the previous edge. (I hope I make my objective and my struggle clear) So wondering if we can do multiple edges of the same edge label between two nodes?


(Michel Conrado) #2

different how? different versions of the same predicate? like visited_time2, visited_time3?

Yeah, Facets are like this. You have to collect all of it first, then mutate with your changes.

In another hand you could just do types of nodes to the edge visited_time. For example, you can use the same predicate, but each new node would represent a “type of visit”. Instead of being a value attribute, it would be a node(object).


(Darius) #3

Yeah, I saw your answer in this link

Thanks for sharing!! It’s super helpful.


(system) closed #4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.