[ZODB-Dev] Re: [Zope3-dev] PROPOSAL: ZODB Relationships
Phillip J. Eby
pje at telecommunity.com
Sat May 10 19:05:02 EDT 2003
At 10:58 AM 5/10/03 -0700, sean.upton at uniontrib.com wrote:
>Naming the association (Reference) with an attribute is a bare-minimum
>requirement for being able to tack on higher-level stuff, like metadata
>common to all instances of a reference with a given name. Does an
>AssociationEnd in MOF have the possibility for a name or label for each end
>corresponding to a role in UML, or is MOF too 'strict' of a subset to allow
>for this?
An AssociationEnd is a TypedElement, so it knows the type it refers
to. TypedElements are ModelElements, so they can have a name and an
annotation (=docstring). Excerpts from my M2-level MOF implementation:
class ModelElement(model.Element):
mdl_isAbstract = True # abstract class
class name(model.Attribute):
referencedType = model.Name
class annotation(model.Attribute):
referencedType = AnnotationType
defaultValue = None
# ... etc.
class TypedElement(ModelElement):
mdl_isAbstract = True # abstract class
class type(model.Attribute):
# this is the class that is the "type" this model element refers to
referencedType = Classifier
# ... etc.
class AssociationEnd(TypedElement):
# ...
>Each Reference or Association should have:
>- Direction (i.e. referencedEnd, exposedEnd)
>- A name / label
>- Some notion of dependency???
>- (optionally) a model type or label**
>
> ** Model could be inferred from label via lookup table?
>
>Each AssociationEnd should have:
>- Name (role)
>- Some binding or reference to the object the end is bound to*
While all of these are useful in principle at the M2 level, it's not clear
to me what you'd do with them at the M1 level in ZODB. If I were writing
an application that used associations, presumably I'd be writing it with
specific associations in mind, and thus any non-operational metadata would
be irrelevant to me.
If I'm implementing the association/reference classes myself, then I might
have interest in some of this metadata to do validation or something, if
that were an intended feature. But the original proposal didn't seem to be
calling for that sort of validation, or *any* metadata-driven behavior, so
far as I could see.
More information about the ZODB-Dev
mailing list