[Zope] referential integrity

seb bacon seb@jamkit.com
Fri, 21 Sep 2001 11:14:51 +0100


* Lukas Maag <lmaag@datacomm.ch> [010921 09:52]:
> In other words, is it possible to store only a reference of an object in a attribute
> of another object. Additionally, the zope database wouldn't allow to delete
> the referenced object while it's still referenced (in a attribute of another
> object).
> 
> if this is somehow possible, it would make zope very, very powerfull.
> 
> thanx, lukas 

because you are creating python classes whose persistent storage is
completely transparent to the user, things like referential integrity
become a functional feature of your program rather than a feature of the
database.  for example, if you have some Elf objects which must only
ever exist as an attribute of Santa objects, you might simply make it so 
that you can only ever access Elves via a Santa API.  IMO this is more 
powerful than the kinds of referential integrity you get in a RDBMS, 
since it's completely flexible: you could allow Elves to exist 
independently of Santa in special circumstances (the Chief Elf might be 
able to promote Elves, for example).

hth

seb