Common attributes - WormBase/db-prototypes GitHub Wiki

The current Datomic schema is build almost entirely on the basis of one namespace per ACeDB class or hash, with one attribute for each informative tag-path within that class (plus :/id attributes which capture object identity).

We should consider creating namespaces and attributes for attributes which have common semantics between classes. This could make code to query the database simpler and rather more elegant. In particular, it will hopefully allow us to avoid code like:

(let [species-ident (keyword class "species")]
  (if-let [species (species-ident obj)]
     ...  ))

There is a trade-off, though: using per-class attributes does give some extra semantic and indexing power, in that if we've got a species, we know that [?gene :gene/species ?species] will efficiently give us genes, with no need for extra filtering. (It may be possible to emulate this without using separate attributes by taking advantage of the fact that we've got our entity IDs partitioned by class, so attributes for a given class should always be co-located in the AEVT index).

Things that are already done via common namespaces

Things we should be considering

  • :locatable/method for classes which have their own Method tag.

  • :object/species

  • :object/reference (or :object/paper?)

Common transcript-model stuff?

Things that should definitely be staying per-class

While having an :object/id attribute is attractive at first glance, it's a non-starter because it makes identifying the class of an object hard, and because -- while object IDs are unique within a class -- there are many duplicate objects between classes.

⚠️ **GitHub.com Fallback** ⚠️