Next: , Previous: Creation of objects, Up: Scheme



6.5 The namespace hierarchy and functions

The namespace hierarchy (n-hierarchy) is a structure of pages and documents in the entire VRR .

The N-hierarchy is an ordering over objects of the obj kind. This ordering can be also viewed as a set of rooted trees (where nodes are objects of obj kind and the root of the tree is the maximum of all nodes in that tree).

One of these trees is more important than others. It is the tree with the object universe as the root. This tree represents the accessible objects, other trees are just temporarily detached (or awaiting for attaching). So the n-hierarchy can be often viewed as one tree.

Functions for manipulating with this hierarchy are usually named with n- prefix.

Comparisions

These functions do the comparison of n-objects in the n-hierarchy. The root is the maximum.


(n<=? o1 x2)
obj obj -> boolean


(n>=? o1 x2)
obj obj -> boolean


(n<? o1 x2)
obj obj -> boolean


(n>? o1 x2)
obj obj -> boolean

Direct movement

These functions return the appropriate n-neighbours of given a object. Being a sibling is considered to be a reflexive relation.


(n-parent o1)
obj -> obj + false


(n-first-child o1)
obj -> obj + false


(n-last-child o1)
obj -> obj + false


(n-first-sib o1)
obj -> obj


(n-last-sib o1)
obj -> obj


(n-next-sib o1)
obj -> obj + false


(n-prev-sib o1)
obj -> obj + false

The rest


(n-leaf? x)
any -> boolean
Returns whether the object x is an n-leaf. An n-leaf is a member of the n-hierarchy which cannot have children (not just an n-object without n-children), i.e. an object of the page type.


(n-children o1)
obj -> list
Returns the list of all n-children of o1. In an unspecified order.


(n-ancestors o1)
obj -> list
Returns the list of all n-ancestors of o1 (i.e. objects that are n-greater than o1). In descending n-order.


(n-descendants o1)
obj -> list
Returns the list of all n-descendants of o1 (i.e. objects that are n-lesser than o1). It is ordered like the pre-order deep-first tree walk, so comparable objects are in descending n-order.


(n-leaves o1)
obj -> list
Returns the list of all n-leaves that are n-lesser than o1. In an unspecified order.


(n-set-parent! o1 o2)
obj obj + false -> unspecified
Sets o2 as the new n-parent of o1. Use false for no parent. This must be called in a meta-transaction.