On 1/31/06, Andreas Hartmann <[EMAIL PROTECTED]> wrote:
> Josias Thoeny schrieb:
> > On Tue, 2006-01-31 at 11:20 +0100, Andreas Hartmann wrote:
> >> Josias Thoeny schrieb:
> >>> One problem I see is the parent-child relations.
> >>> For example, now it's not possible to publish a document if its parent
> >>> is not published. This guarantees some kind of "integrity".
> >>> If you have multiple hierarchical site structures, you cannot have this
> >>> kind of dependency constraints.
> >> I think that would be possible. The current SiteManager interface
> >> allows to define a dependency relation, which could be implemented by
> >> all site structures to ensure integrity constraints.
> >
> > The constraints are derived from the site structure, which is a directed
> > acyclic graph. If there are multiple site structures, the constraints
> > must be derived from the union of all those graphs, which is not acyclic
> > anymore.
>
> This is of course true, but does it present a problem?
> > See this simple example with docs A and B:
> > /struct1/A/B.html
> > /struct2/B/A.html
>
> In this case, not either A or B can be deleted, only both of them.
> It would be possible to generate a message like:
> Node A cannot be deleted because it is required by other nodes:
> ...

Solving for any case is easy.
First, each document has a primary parent that cannot be a descendant
of the current document.  So if you have //A//B and //B//A, only one
of those could be the primary relationship.

Second, allow orphans: documents whose parents do not exist in the
current selection.  That handles deleting the parent without deleting
the child.  It also handles publishing the child without publishing
the parent.  Orphans appear in flat views (we do not want to lose
access to them), but do not appear in a hierarchy if their parent is
missing (because the hierarchy tree is created by accessing only
documents that met the selection criteria.)

An editor using a different hierarchy can enforce different integrity
rules, but the parent-child relationship is not critical to integrity
with flat storage.  Each editor's navigation and actions deals with
its own implemtation, but none of that will corrupt the Lenya storage.

You might be unhappy if you orphan a large portion of your website, so
only use an editor that enforces the rules needed for your website. 
Using a flat view and randomly deleting documents is a good method to
destroy your website.  The orphaned documents would still exist, could
be found easily using the "orphans" view, and could be assigned new
parents.  Or the flat view's Delete function could lookup whether a
document has children (using the AllRelationships table which knows
every parent-child relationship from every alternate structure) and
enforce the rules.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to