Fork me on GitHub

possibly a stupid question: does asami allow you to associate weights (or other properties) to edges? (Like setting properties on a relationship in Neo4j: (:Person {person_id:'123'})-[:FRIEND {date:'1972-01-01'}]->(m:Person {person_id:'456'}) [I.e. Person 123 and Person 456 have been friends since 1972-01-01] )


If you use the in-memory multi graph then yes


URL scheme is asami:multi:


You can add edges multiple times, or if you use the graph update function on a connection, you can update the graph with another function that lets you set the number more directly


This is done by passing a connection to the function along with a function that receives a graph and a transaction number to use. That function can then call asami.multi-graph/multi-graph-add e.g.

(storage/transact-update my-connection
  (fn [graph txid]
    (multi-graph/multi-graph-add graph entity attribute value txid weight)))


(The index keeps a count value for edges. It does not store multiple edges)


Cisco was using this specifically to weight edges that were being displayed, so the plotting algorithm could make useful decisions on layout


Oh, sorry @kiran.joshi. I was on my phone and didn’t read the full question about other properties.


For now, multigraphs have weight


Durable storage has allocated an ID for every statement (i.e. each individual edge), and properties can be given to these. BUT… I haven’t exposed it, because I don’t know what the API should look like yet


I thought that this was a decision I could put off for a while longer, because no one had asked for it 🙂


This isn’t an afterthought. It would be slightly cheaper to not have these IDs. But I wanted to support reification on edges, specifically like this, so I built it in


If anyone has ideas on how they want to access this (specifically, by querying), then please let me know.


At this point, the easiest way would be as a 4th element in a pattern in the :where clause. But I’ve been reluctant to do that because that has a completely different meaning in Datomic