[Zope3-dev] zwiki: performance of findChildren()

Benjamin Saller bcsaller@ideasuite.com
30 Apr 2003 09:32:58 -0400


--=-MVXP0myiHz1OHLF6BZcZ
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Perhaps the solution I've been using to this problem in Z2 land has been
too simple, but I think its the simplicity of the solution that has
allowed me to move forward with it. I put it out here as food for
thought.

Objects in Archetypes has UID's associated with them that are
characteristically the same as HubIds, they also implement
IReferenceable which makes up for the lack of a real object hub and
event system in Z2. From this the following type of test derive.=20
=09
	##Make 3 content objects, a, b, and c
	[SNIP]

	#Two made up kinda refs
        a.addReference(b, "KnowsAbout")
        a.addReference(c, "Owns")
                                                                           =
              =20
        assert b in a.getRefs()
        assert c in a.getRefs()
        assert a.getRefs('Owns') =3D=3D [c]
        assert c.getBRefs('Owns')=3D=3D [a]
        rels =3D a.getRelationships()
        assert "KnowsAbout" in rels
        assert "Owns" in rels
                                                                           =
              =20
        a.deleteReference(c)
                                                                           =
              =20
        assert a.getRefs() =3D=3D [b]
        assert c.getBRefs() =3D=3D []
                                                                           =
               From this we have simple reference, back references and the =
ability to qualify relationships by introducing a token to discriminate amo=
ng them. The references are stored externally to the objects and can me man=
ipulated either by accessing the tool responsible for them directly or usin=
g the helper methods on included when implementing the IReferenceable inter=
face.


No real policy is implemented here in terms of what types of
relationships are supported and that can be left to a higher level
system or simply the UI. Using the tool traversal through the reference
graph can be done quickly and w/o having to touch the real object. Aside
from some cleaning up the spelling in the API and possible changing
references to relationship this system has worked fine.


-Ben


On Fri, 2003-04-25 at 15:01, Gary Poster wrote:
> Roch=C3=A9 Compaan wrote:
> > * Jeremy Hylton <jeremy@zope.com> [2003-04-25 19:50]:
> ...
> >=20
> >=20
> > I think the cardinality of the relationship is important too. If it is
> ...
>=20
> FWIW, There has already been work done by myself and others, based=20
> somewhat on=20
> http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Relation=
shipService
>=20
> I have some better developed interfaces somewhere in a sandbox, and I=20
> think we have an Asymmetric Transitive relationship type that Tres=20
> implemented and improved the interface on that we can use eventually.  I=20
> don't have time to work on this right now, but maybe I will later.  A=20
> number of people want it, and a number of people have ideas and even=20
> code towards it.
>=20
> Gary
>=20
>=20
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-dev

--=-MVXP0myiHz1OHLF6BZcZ
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQA+r9CKjIX9QWVlvvoRAtLTAJkBFNG4NwfRQvfcT3ns4lcFI7YkHgCgymcF
qza3dUZSwBvh9Qg15namcHo=
=0ebi
-----END PGP SIGNATURE-----

--=-MVXP0myiHz1OHLF6BZcZ--