Fork me on GitHub

hi, i need to model labeled edges and i'm wondering about the best way to do it in a db like datomic or crux. I have relations like this, using cypher: (a:A)-[r:REL {foo: "bar", ...}]->(b:B). the off-the-shelf way to do this is to make the relation a separate entity and join to a and b on r , like {:r/id :my-id, r/a-join :id-for-a, :r/b-join :id-for-b, :edge-attr1 ..., :edge-attr2 ...} but I want to instead model it by having a have a join to r and have r have a join to b: this helps me structurally represent the directionality of this edge. hope that makes sense--can anyone comment on whether it'd be OK to pursue the latter model, and whether there are any others i ought to consider?


Are you saying that you want to have a unique label for every edge?


sorry, should have made that clearer: i mean i need every edge to be an entity because i want to label each edge with various attributes


updated my example above


Yeah, I think for something like Datomic you’ll need to model with an entity per edge


I have the exact same challenge right now, and came to the same conclusion this morning. I think we need an entity per edge, or a general entity like

:in  :ref
:out :ref
:additional-stuff ...


But I'm not 100% sure yet, since it's my first project with datomic