Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Validation OCLParser EcoreEnvironment.findPackage and empty packages.
EMF Validation OCLParser EcoreEnvironment.findPackage and empty packages. [message #415208] Wed, 05 December 2007 13:42 Go to next message
LoÃ?¯c QuÃ?©ran is currently offline LoÃ?¯c QuÃ?©ranFriend
Messages: 45
Registered: July 2009
Member
Empty packages are not generated by EMF. See
http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 1984.html
for an explanation on this.

org.eclipse.ocl.ecore.EcoreEnvironment.findPackage(List<String >
packageNames, EPackage.Registry registry) explicitely searches root
level packages (line 558):

// only consider root-level packages when searching by name
if ((ePackage.getESuperPackage() == null)
&& EcoreForeignMethods.isNamed(name, ePackage))
{
....
}

Packages which are not generated won't be registered, hence won't be found.

Unless I miss something, EMF Validation will not parse OCL files
correctly if the "target" ecore's top level package is empty.

Have I missed something ? Shouldn't the EcoreEnvironment algorithm be
somewhat more robust ?

Loïc
Re: EMF Validation OCLParser EcoreEnvironment.findPackage and empty packages. [message #415209 is a reply to message #415208] Wed, 05 December 2007 13:47 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Loïc,

This is really an OCL question, hence I am replying to that newsgroup.

The EcoreEnvironment tries to be more robust. If it can't find the
referenced package by the nesting structure, then it attempts to find an
EPackage whose nsPrefix matches what EMF produces by default (being simply
a dot-separated list of the package names). For example, in resolving
a::b::c, if the "a" package can't be found, the environment tries looking
for a package whose nsPrefix is a.b.c.

Another thing you can do is to initialize your EcoreEnvironment with a
default package, specifying the root package that isn't registered. Then,
package name references that are relative to this root package (or even
absolute names, I think) should be registered.

Otherwise, if a package cannot be found, I don't see how OCL can assume that
the reason is an empty root package that isn't registered, and proceed by
looking up the child. It can easily get entirely the wrong package.

Perhaps you should follow this enhancement request:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=142856

and maybe even contribute a patch!

Cheers,

Christian

Loïc Quéran wrote:

> Empty packages are not generated by EMF. See
> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg1 1984.html
> for an explanation on this.
>
> org.eclipse.ocl.ecore.EcoreEnvironment.findPackage(List<String >
> packageNames, EPackage.Registry registry) explicitely searches root
> level packages (line 558):
>
> // only consider root-level packages when searching by name
> if ((ePackage.getESuperPackage() == null)
> && EcoreForeignMethods.isNamed(name, ePackage))
> {
> ...
> }
>
> Packages which are not generated won't be registered, hence won't be
> found.
>
> Unless I miss something, EMF Validation will not parse OCL files
> correctly if the "target" ecore's top level package is empty.
>
> Have I missed something ? Shouldn't the EcoreEnvironment algorithm be
> somewhat more robust ?
>
> Loïc
Previous Topic:Attributes not showing on Properties View
Next Topic:Modify standard XMI serialization
Goto Forum:
  


Current Time: Tue Apr 16 04:58:14 GMT 2024

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

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

Back to the top