Closed cgrand closed 4 years ago
The tree of queries is used to generate paths and paths lead to components.
For a fragment, its paths are the paths of its children prefixed by the child index
paths_some_fragment(p) :- paths_child_0(p'), append([0], p', p)
...
paths_some_fragment(p) :- paths_child_N(p'), append([N], p', p)
For a for, its paths are the paths of its children prefixed by the child key
paths_some_for(p) :- query_of_this_for(a_0, ..., a_N), paths_this_body(p'), append([a_k_0, .. a_k_M], p', p)
Ok this shows up deficiencies in my above notation: some arguments ahave to be passed to the body.
paths_node(self, p) :- paths_node_for1(self, p)
paths_node_for1(self, p) :- datom(self, :node/name, _), path_node_for2(self, p'), append([true], p', p)
paths_node_for2(self, p) :- datom(self, :node/children, child), paths_node(child, p'), append([child], p', p)
Replacing query trees by rules sounds like an option; the sue of the impure append may cause trouble if there's a cycle in data.
implemented
Let's imagine displaying a tree.
Currently it fails as the system tries to get a tree of queries out of this and this tree ends with an infinite depth.
Obviously recursive templates may be dangerous in the same way
...
is dangerous in datomic'spull
. A recursion limit option on the template may be good.