Hi Jörn,
If you do the below, then "Vector" will be ambiguous - you have two
options. One is to use the fully-qualified type name; assuming the
name of the package containing Vector in the metamodel "type" is
"type", and similarly for the metamodel "instance", then you would
write fully-qualified names ::type::Vector and ::instance::Vector to
disambiguate them. The alternative is to import the metamodels into
different namespaces (this is required when the fully-qualified names
are the same, as may occur with different versions of the same
metamodel). Thus:
NAMESPACE t type
NAMESPACE i instance
RULE matchVectors
FORALL i^Vector inst, t^Vector type
WHERE conforms(inst, type)
MAKE println(inst, type)
;
Thus, two namespaces ("t" and "i") are defined for the transformation
and are populated by the names (simple and fully qualified) from the
associated metamodels.
michael
On 10/31/07, Jörn Guy <jgsu...@itee.uq.edu.au> wrote:
> I have a metamodel that contains cross references across packages. I
> have an "instance" package, which contains model elements representing
> samples for testing, and a "type" package, that contains model
> elements describing the types that the instance have to comply with.
> In order to make local operation simple, I reuse terms. hence there is
> a type/Vector and an instance/Vector. I was wondering how I would
> address these in the bindings of Tefkat rules?
> If I do
> NAMESPACE type
> NAMESPACE instance
> "Vector" will always resolve to type/Vector..
> I would assume that their may be many cases in practice where such
> namespace collisions occur. Especially, since the models may be
> created seperately and certain popular 'pattern-like' terms like
> 'NamedElement' are bound to reappear...