Search code examples
clojuredatomic

entity type attribute in every datomic entity


Is it idiomatic to tag every entity in Datomic database, with a universal "type attribute", i.e. :entity/type? Or it is better not to do it, and derive type from combination of attributes.


Solution

  • In the tutorial they use namespace keywords for all their attributes like this:

    :community/name 
    :neighborhood/name
    :district/name
    

    to avoid name collisions. I've used this strategy without problems and it seems to be the idiomatic way. When you want to know if an entity is a community you ask for some mandatory attribute like :community/name and check if it is there.