(add-to-unique-index! fact ks)
Prepreds :unique to keyseq path in second argument. Overwrites existing value and returns it if found.
Prepreds :unique to keyseq path in second argument. Overwrites existing value and returns it if found.
(clara-tups->maps tups)
Takes seq of ms with keys :?e :?a :?v, joins on :?e and returns vec of ms (one m for each entity)
Takes seq of ms with keys :?e :?a :?v, joins on :?e and returns vec of ms (one m for each entity)
(conflicting-logical-fact-error facts to-insert to-retract)
(dissoc-in m [k & ks :as keys])
Dissociates an entry from a nested associative structure returning a new nested structure. keys is a sequence of keys. Any empty maps that result will not be present in the new structure.
Dissociates an entry from a nested associative structure returning a new nested structure. keys is a sequence of keys. Any empty maps that result will not be present in the new structure.
(entity-map->Tuples m)
Transforms entity map to Tuple record {a1 v1 a2 v2 :db/id eid} -> [(Tuple eid a1 v1 t)...]
Transforms entity map to Tuple record {a1 v1 a2 v2 :db/id eid} -> [(Tuple eid a1 v1 t)...]
(fact-index-path fact)
Returns path to store and access a fact in fact-index according to the fact's cardinality, uniqueness
Returns path to store and access a fact in fact-index according to the fact's cardinality, uniqueness
(fact-index-paths fact)
Returns all index paths for a given fact as [[]...]
Returns all index paths for a given fact as [[]...]
(insert session facts)
Inserts facts from outside rule context.
Accepts [e a v]
, [[e a v]...]
, {}
, [{}...]
, where {}
is a Datomic-style entity map
Inserts facts from outside rule context. Accepts `[e a v]`, `[[e a v]...]`, `{}`, `[{}...]`, where `{}` is a Datomic-style entity map
(insert! facts)
Insert facts logically within rule context
Insert facts logically within rule context
(insert-unconditional! facts)
Insert facts unconditionally within rule context
Insert facts unconditionally within rule context
(insertable x)
Arguments can be any mixture of vectors and records Ensures [], [[]...], Tuple, '(Tuple ...) conform to Tuple record instances.
Arguments can be any mixture of vectors and records Ensures [], [[]...], Tuple, '(Tuple ...) conform to Tuple record instances.
(make-activation-group-fn default-group)
Reads from optional third argument to rule.
:super
- boolean
:group
- keyword
:salience
- number
Rules marked :super
are given the highest priority.
Reads from optional third argument to rule. `:super` - boolean `:group` - keyword `:salience` - number Rules marked `:super` are given the highest priority.
(make-ancestors-fn)
(make-ancestors-fn hierarchy)
(make-ancestors-fn hierarchy root-fact-type)
Returns a set. To be used when defining a session. Stored in atom for auto truth maintenance and schema enforcement.
Returns a set. To be used when defining a session. Stored in atom for auto truth maintenance and schema enforcement.
(map->tuples m)
Transforms entity map to vector of tuples {a1 v1 a2 v2 :db/id eid} -> [[eid a1 v1]...]
Transforms entity map to vector of tuples {a1 v1 a2 v2 :db/id eid} -> [[eid a1 v1]...]
(map-of-refs? schemas x)
Returns true if every k is db.type/ref according to a schema
Returns true if every k is db.type/ref according to a schema
(remove-fact-from-index! fact)
(remove-fact-from-index! fact paths)
Removes fact from all indexed locations according to schema if the indexed value is identical
to the fact
argument.
Returns [bool...]
indicating successful removal from each indexed location.
Removes fact from all indexed locations according to schema if the indexed value is identical to the `fact` argument. Returns `[bool...]` indicating successful removal from each indexed location.
(remove-from-fact-index! fact ks)
Removes fact from single path in index, returning a retract instruction if an exact match was found
Removes fact from single path in index, returning a retract instruction if an exact match was found
(retract session facts)
Retract from outside rule context.
Retract from outside rule context.
(retract! facts)
Wrapper around Clara's retract!
. Use within RHS of rule only.
Requires a fact that includes a fact-id produced by matching on a whole fact.
e.g. ?fact
in [?fact <- [?e :attr ?v]
Wrapper around Clara's `retract!`. Use within RHS of rule only. Requires a fact that includes a fact-id produced by matching on a whole fact. e.g. `?fact` in `[?fact <- [?e :attr ?v]`
(split-head-body rule)
Takes macro body of a define and returns map of :head, :body
Takes macro body of a define and returns map of :head, :body
(tuple-entity->hash-map-entity tuples)
Takes list of tuples for a single entity and returns single map
Takes list of tuples for a *single* entity and returns single map
(tuplize-into-vec x)
Returns [[]...]. Arg may be {} [{}...] [] [[]...]
Returns [[]...]. Arg may be {} [{}...] [] [[]...]
(update-index! fact)
(update-index! fact ks)
Primary function that updates fact-index. Requires fact to index. Generates key-seq to path in index.
Primary function that updates fact-index. Requires fact to index. Generates key-seq to path in index.
(upsert-fact-index! fact ks)
Writes value to path in ks. Returns existing fact to retract if overwriting.
Writes value to path in ks. Returns existing fact to retract if overwriting.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close