Composites

As we saw earlier, Entities are simply groups of facts that share an entity id:

The last fact is kind of a black sheep though since the :site/cat attribute is not in the Person namespace.

Avoid non-intrinsic pollution

Since entities can have attributes from any namespace we have a challenge of how to model this in our
schema definiton. It would be quick and easy to just make a relationship from a Person namespace to
the Site namespace:

Relationships to Site are simply not intrinsic to or a natural core part of neither Person, Company or Project.
Littering non-intrinsic relationships to Site - and possibly other cross-cutting namespaces like Tags, Likes etc - all
over the place quickly clutters and pollutes our domain model.

Instead we want to create a more “loose association” to Site. This is what Datomic allow us to do by letting an entity id
tie any attributes together as we see in the list of facts at the top of this page.

Composite modelling

In Molecule we can model “associative relationships” - or “composites” with the ~ method: