Hi Henrik,

> of a heavier web framework than pl-web and for the read part I need to
> be able to walk through all objects of a certain type regardless of
> what kind of keys and references they might or might not have.
> ...
> (dbs
>    (4 +User)                                   #1
> ...
> (dm read> ()
>    (let Cur (car (get This 'Dbf))
>       (make
>          (while (setq Cur (seq Cur))
>             (link Cur) ) ) ) )

OK, you are on the right track. 'seq' is the way to access all objects
in a given file independent from indexes and references.

I always use the following pattern in such cases:

   (for (This (seq (db: +User)) This (seq This))
      (when (isa '+User This)
         (doSomething This) ) )

> The above works but not for +User (I assume because they are in the
> first file), trying (read> '+User) will still return some relations.

Right. The reason is that the first DB file contains also other,
non-entity objects holding meta informations. Most notably the root
object (in '*DB')

> {1} NIL
>    +Menu {7}
>    +Block {6}
>    +Page {5}
>    +User {3}

and also the the bases of indexes like

> {5} NIL
>    parent (5 . {G3})
>    path (6 . {G2})
>    name (6 . {G1})

> Of course I could filter them but there must be a better/more
> efficient way?

A filter is necessary here. But I would not worry, a simple 'isa' as in
my example above won't introduce a noticeable overhead.

   (3 (+Page name path parent))                #8
> (rel name   (+Ref +String))
> (rel path   (+Key +String))
> (rel parent (+Ref +Link) NIL (+Page))
> I would have expected those refs and key to end up in file #8?

Correct. But while the _nodes_ of those index trees do indeed reside in
#8, the _base_ still is in an external symbol in #1.

- Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to