Skip to content

Instantly share code, notes, and snippets.

@decoursin
decoursin / datomic-rules.clj
Last active June 17, 2023 16:03 — forked from taylorSando/datomic-rules.clj
Datomic recursion using rules
(defn recursive-rule
"A recursive rule for establishing prototype inheritance/isa relationship.
Can specify a maximum depth to travel, or none if there are no restrictinos.
rule The name of the rule
e The entity
a The attribute
v The value
Should be creating the rule like: (recursive-rule 'isa '?e '?a '?v)
Then within a query, can refer to it like this:
(isa ?e :thing/isa ?v) "