How do you add relationship properties, e.g. the time a person met another person?

I have some experience with Neo4j / cypher. In cypher relationships are first-class citizens, so they can have properties, which I really like.

I’m very new to datomic / datalog, sorry in advance if I’m asking a dumb question…
How do I do something similar with datomic? Or do I simply approach the problem from a wrong perspective and should learn a new way of thinking about this?

In Datomic, a reference cannot have any extra data in itself. The reference attribute is an entity like all attributes and can have general data about the attribute, but that is not what you are asking for.

In Datomic you could model a meeting between two (or more) persons as an entity pointing to all persons that was in the meeting, and put data such as when the meeting occured on that meeting-entity.

You could also chose to add data on the transaction entity when adding information about the meeting.

There is no way to create a “symmetric” reference, either you create two references between the persons or have to decide on which person a “know-the-other-person”. This quickly becomes tedious. References in datomic can be queried both forward and backward, but it would still be complicated to write correct queries if you model the reference from one person to the other.

In general I would think of a meeting as something that should be reified and described as its own entity, not the least to be able to express all persons participating in the meeting in an equal manner.

The query will become something like:

[:find ?friend 
 :in ?current-user 
 :where
 [?meething :meeting/included ?current-user]
 [?meething :meeting/included ?friend]]

(+ some logic or clause to remove ?current-user from the result-set)

and given the ?meeting you could also ask for timestamp or similar to know when the meeting happened.

If you want to do this on a very large scale, and are using datomic-pro on-prem, you can quite easily listen to all changes in the database and keep a peer-local index in some suitable data structure that keeps an updated index

user->friends

in the form of a simple hash-map with sets of friends (as eids for instance). This way you will only use the meeting entities as a kind of event sourcing to find out the current friend-list (+ of course you would need to know who unfriended who etc).