Containment Relations ( :db.type/ref + :db/isComponent )
:db/isComponent used to indicate containment relationships, i.e. composition relationships from UML. You can think of it as a "relation A B. "A striking example is the model part of a simple blog:

In Datomic, if you use the :db/isComponent as part of the Article-Comments relationship above, retracting the article will also cancel all of its comments. For a complete code example, consider Datomic: a containment relationship, i.e. db / isComponent .
Note in Datomic there is nothing that would prevent the wrong type of object from being added to the attribute :db.type/ref . In the above example, Datomic will allow you to add a link to the Author object (instead of a comment) without much care. This means that foreign key constraints come into play.
Foreign key constraints ( :db.type/ref + database functions)
Datomic defines the relationship using the attribute :db.type/ref , but actually does nothing. To use arbitrary foreign key constraints, you should use the database functions instead.
In the Seattle database that you are referring to, the attributes :community/orgtype should only refer to a few valid enum values ( :community.orgtype/* ), but there is actually no execution at runtime:

To show how arbitrary foreign key constraints can be implemented in Datomic, I wrote a database function (called add-fk ) that prevents the value of an invalid enum from being bound to attributes :community/orgtype .
For a complete code example, consider Datomic: database functions and foreign key constraints . For example, the behavior of the add-fk database function is shown below:
;; will succeed [[:db/add
a2ndrade
source share