Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Prefix of used metamodels
[Acceleo] Prefix of used metamodels [message #753954] Mon, 31 October 2011 07:25 Go to next message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member
Hello,

I was writing a MTL transform on a metamodel (let's call it mm1) which contains an EClass named 'Integer'.

The module looks like
module Mod1('http://example.org/mm1/1')


Of course, this had the effect of shadowing the standard Integer type.
After some experimentation (and with luck), we found out that the standard Integer type can be referred to by 'oclstdlib::Integer'.

However, it's not certain which EClass this actually is. (i.e. which NRUri corresponds to the oclstdlib prefix).

So, the questions are:
1) Where is the correspondence between a namespace name and a package URI, which is accessible from a MTL module, defined ?

2) Which packages are implicitly imported into any Acceleo MTL module ?

3) How are imported package name collisions handled ?

4) Is there a way to reference a namespace with a user-chosen prefix ?
( e.g. module Mod1(mm1:'http://...') )

5) Is the 'OCL Model registry' used by Acceleo for mapping URIs to prefixes?

Regards,
Vlad
Re: [Acceleo] Prefix of used metamodels [message #753966 is a reply to message #753954] Mon, 31 October 2011 09:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Vlad

The main program for your transformation is auto-generated, but it has
significant scope for customisation; read the comments.

Name clashes should be an error.

4) module Mod1(mm1:'http://...'

Nice idea. Raise a Bugzilla and an OMG issue.

5) OCL Model registry

I very much doubt that it is used by Acceleo.

It was originally the QVT Declarative Model Registry where it solved two
problems.

a) prefix to logical URI
b) logical URI to physical URI

a) is arguably a QVTr, QVTc language bug; MOFM2T (Acceleo) and QVTo do
not have a problem since logical URIs can form part of the concrete
syntax; QVTr and QVTc should be fixed.

a) was also used to provide less-telepathic package discovery for
Complete OCL; again a language bug. The Eclipse Complete OCL editor has
import/include/library declarations for some of which there is an OMG issue

b) is useful, but MWEStandaloneSetup has demonstrated how the classpath
can be used. My ProjectMap contribution to EMF
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=361063) takes this further.

Regards

Ed Willink


On 31/10/2011 07:25, Vlad Gheorghe wrote:
> Hello,
>
> I was writing a MTL transform on a metamodel (let's call it mm1) which
> contains an EClass named 'Integer'.
>
> The module looks like
> module Mod1('http://example.org/mm1/1')
>
>
> Of course, this had the effect of shadowing the standard Integer type.
> After some experimentation (and with luck), we found out that the
> standard Integer type can be referred to by 'oclstdlib::Integer'.
>
> However, it's not certain which EClass this actually is. (i.e. which
> NRUri corresponds to the oclstdlib prefix).
>
> So, the questions are:
> 1) Where is the correspondence between a namespace name and a package
> URI, which is accessible from a MTL module, defined ?
>
> 2) Which packages are implicitly imported into any Acceleo MTL module ?
>
> 3) How are imported package name collisions handled ?
>
> 4) Is there a way to reference a namespace with a user-chosen prefix ?
> ( e.g. module Mod1(mm1:'http://...') )
>
> 5) Is the 'OCL Model registry' used by Acceleo for mapping URIs to
> prefixes?
> Regards,
> Vlad
>
Re: [Acceleo] Prefix of used metamodels [message #754674 is a reply to message #753966] Thu, 03 November 2011 20:10 Go to previous messageGo to next message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member
Thanks for the response, Ed.

I've read through the generated AbstractAcceleoGenerator subclass, as suggested, but I dont's see how this relates to the namespace prefix used in the MTL files. Could you please explain ?


Can anyone respond to the open questions, please ?

Re: [Acceleo] Prefix of used metamodels [message #754756 is a reply to message #754674] Fri, 04 November 2011 08:33 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Vlad,

1) Where is the correspondence between a namespace name and a package URI, which is accessible from a MTL module, defined ?

The namespace corresponding to a given NsURI is the name of the package. "ecore::" for the Ecore metamodel, "uml::" for the UML metamodel, "oclstdlib::" for OCL... and whatever you named your package in the "http://example.org/mm1/1" case.

2) Which packages are implicitly imported into any Acceleo MTL module ?

The OCL standard library is the only meaningful one. Acceleo's standard and non-standard libraries are there too, but they do not provide anything you should reference directly except for additional operations.

We also try and implicitly import any metamodel yours might depend on. If you depend on Ecore, the ecore package should be imported by Acceleo without forcing you to explicitly import it in the module declaration (it is still good practice to explicitly declare it though).

3) How are imported package name collisions handled ?

No idea. Ed might know, but chances are this is in the legacy OCL code. My guess is that if two packages with the same name and different NsURIs both provide the same type "Integer", only the first of the two will ever be found : we iterate on all packages and return the first type that matches <namespace>::<name>.

4) Is there a way to reference a namespace with a user-chosen prefix ?
( e.g. module Mod1(mm1:'http://...') )

No. As Ed mentionned, this might be an interesting enhancement. Please raise an enhancement request for it on https://bugs.eclipse.org/bugs/enter_bug.cgi?product=M2T&component=Acceleo.

5) Is the 'OCL Model registry' used by Acceleo for mapping URIs to prefixes?

No.

Laurent Goubet
Obeo
Re: [Acceleo] Prefix of used metamodels [message #754837 is a reply to message #754756] Fri, 04 November 2011 14:59 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi
> 3) How are imported package name collisions handled ?
>
> No idea. Ed might know, but chances are this is in the legacy OCL
> code. My guess is that if two packages with the same name and
> different NsURIs both provide the same type "Integer", only the first
> of the two will ever be found : we iterate on all packages and return
> the first type that matches <namespace>::<name>.
I have no idea either, without reading the code, which is why I just
suggested that it should be an error. I do know that the package
resolution mechanism is slightly different for the Ecore and UML
bindings of OCL. The behaviour is not intuitive and so the Indigo
release provides a three-way option that allows the outwards resolution
defined by OMG to have higher/lower/exclusive priority with respect to a
more logical alias-based resolution policy.

For the new pivot OCL in which Complete OCL is recognised as a package
merge, my current thinking is that packages have URIs, and packages with
the same URIs are merged subject to the to-be-specified package merge
semantics. From this point of view, the package name is a convenient
local alias for the URI, therefore package name clashes may or may not
be URI clashes and may or may not be resolvable by the scoping in which
the name is declared and referenced.

Clearly, use of clashing names is unwise, since the semantics of a clash
may not be sensible now and might different in the future.

Regards

Ed Willink
Re: [Acceleo] Prefix of used metamodels [message #754913 is a reply to message #754837] Fri, 04 November 2011 22:22 Go to previous message
Vlad Gheorghe is currently offline Vlad GheorgheFriend
Messages: 127
Registered: May 2011
Senior Member
Hi guys,

Thanks for the clarifications.

I've submitted the enhancement request
https://bugs.eclipse.org/bugs/show_bug.cgi?id=362955

Regards,
Vlad
Previous Topic:Java wrapper doesn't work
Next Topic:[JET] More than one level of transformation overrides
Goto Forum:
  


Current Time: Fri Apr 19 05:43:33 GMT 2024

Powered by FUDForum. Page generated in 0.02518 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top