Fork me on GitHub
Drew Verlee03:04:38

I'm using datomic cloud and i get the exception " I dont understand what the that means? why isn't it allowed? i assume their is something wrong with the function. Backing up, the goal is to enforce that every floor has a building. This is just a learning exercise, so i'm open to any interperation of how it would be best to solve this. code:

(defn floor-has-one-building-v4?
  [db eid]
  (let [building (d/pull db '[{:building/_floor [:building/name]}] eid)]
    (= (count building) 1)))

(def predicate
  {:db/ident        :floor/guard4
   :db.entity/attrs [:floor/name]
   :db.entity/preds '})

  (d/transact conn {:tx-data [predicate]}))

(d/transact conn {:tx-data [{:building/name  "Big Building"
                             :building/floor [{:floor/name "bottom"
                                               :db/ensure  :floor/guard4}]}]})

Joe Lane15:04:14

I second what ghadi said. I just noticed that your "exception" message says "... by datomic/on/config". If that isn't a slack typo, it needs to be datomic/ion-config.edn (per

👍 4

@drewverlee entity predicates need to be on the classpath of the primary compute group


and mark them under the :allow section


entity preds do not run on the client submitting the transaction, they run on the server (the primary/transactor)


Below is from the datomic documentation -

The V-leading index VAET supports efficient queries for references between entities, analogous to a graph database.

The combination of EAVT and VAET supports arbitrary nested navigation among entities. This is like a document database but vastly more flexible. You can navigate in any direction at any time, instead of being limited to the containment hierarchy you selected when storing the document.
The above tells me that datomic is a good fit where the data is being modelled as a graph / document. Are there any examples of graph data / document data being modelled in datomic ? Most examples I see is of relational / cloumnar types.


@murtaza52 There’s a lot of overlap there. For a document store, you just need an entity identifier and some attributes on that entity. For graphical data, you just need to reference other entities (via :db.type/ref).