Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Accessing subpackages in EVL
Accessing subpackages in EVL [message #16904] Thu, 30 April 2009 11:57 Go to next message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Hello!

Another simple question about EVL. What is a syntax to access subpackage's
classes?

The syntax subPackageOfPackageA::subClass seems not to work in the .evl
file which is associated with PackageA.

Also I've found out that there's an ! operation in EOL which gives access
to metamodel's elements like:

ModelName!packageName::className

but it's not clear how to use it in EVL, where do I get the ModelName?
Re: Accessing subpackages in EVL [message #16965 is a reply to message #16904] Thu, 30 April 2009 12:05 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

If you only have one model, you can skip the ModelName! part and just
use packagename::classname

Cheers,
Dimitris

Yuri G wrote:
> Hello!
>
> Another simple question about EVL. What is a syntax to access
> subpackage's classes?
> The syntax subPackageOfPackageA::subClass seems not to work in the .evl
> file which is associated with PackageA.
>
> Also I've found out that there's an ! operation in EOL which gives
> access to metamodel's elements like:
>
> ModelName!packageName::className
>
> but it's not clear how to use it in EVL, where do I get the ModelName?
>
Re: Accessing subpackages in EVL [message #16992 is a reply to message #16965] Thu, 30 April 2009 12:40 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Dimitris Kolovos wrote:
> Hi Yuri,
>
> If you only have one model, you can skip the ModelName! part and just
> use packagename::classname

this should read PackageA::subPackageOfPackageA::subClass

>
> Cheers,
> Dimitris
>
> Yuri G wrote:
>> Hello!
>>
>> Another simple question about EVL. What is a syntax to access
>> subpackage's classes?
>> The syntax subPackageOfPackageA::subClass seems not to work in the
>> .evl file which is associated with PackageA.
>>
>> Also I've found out that there's an ! operation in EOL which gives
>> access to metamodel's elements like:
>>
>> ModelName!packageName::className
>>
>> but it's not clear how to use it in EVL, where do I get the ModelName?
>>
Re: Accessing subpackages in EVL [message #17021 is a reply to message #16992] Thu, 30 April 2009 13:05 Go to previous messageGo to next message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Dimitris Kolovos wrote:

> this should read PackageA::subPackageOfPackageA::subClass

It works this way. Thank you very much, Dimitris!

Yet another question: is it possible to access arbitrary metamodel from my
evl constraint?

For example in QVTO there's a 'modeltype' construction which gives access
to any metamodel:

modeltype MINDMAP uses mindmap('http://www.example.org/mindmap');
...
var myTopic := object MINDMAP::Topic {};
Re: Accessing subpackages in EVL [message #17050 is a reply to message #17021] Thu, 30 April 2009 13:39 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

In the current version you only have access to the metamodel specified
in the namespaceURI attribute of the extension. Can I ask what's your
use case for this? We'd certainly be happy to support this in future
versions of Epsilon if there's good motivation.

Cheers,
Dimitris

Yuri G wrote:
> Dimitris Kolovos wrote:
>
>> this should read PackageA::subPackageOfPackageA::subClass
>
> It works this way. Thank you very much, Dimitris!
>
> Yet another question: is it possible to access arbitrary metamodel from
> my evl constraint?
> For example in QVTO there's a 'modeltype' construction which gives
> access to any metamodel:
>
> modeltype MINDMAP uses mindmap('http://www.example.org/mindmap');
> ..
> var myTopic := object MINDMAP::Topic {};
>
>
>
Re: Accessing subpackages in EVL [message #17079 is a reply to message #17050] Thu, 30 April 2009 14:47 Go to previous messageGo to next message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
I see, Dimitris, thanks for reply. Let me illustrate my case.

The metamodel is split into two .ecore files:

<CoreMM.ecore>
CorePackage : EPackage
CoreSubPackage : EPackage
CoreClass : EClass (contains ClassX elements)
ClassX : EClass (contains references to ClassY)
ClassY : EClass (abstract)

<ChildMM.ecore>
ChildPackage : EPackage
ChildSubPackage : EPackage
ChildOfY : EClass -> ClassY

Developed GMF editor for CoreClass can draw diagram nodes for ClassX and
ChildOfY meta-elements.

I've created a .evl constraint binded to CoreSubPackage namespaceURI:

context ClassX {...}

Now I'd like to implement a quick-fix in this constraint which would
create a ChildOfY node in my diagram and add a reference to it into the
validated ClassX if needed. But there's no way I can get to ChildOfY
EClass to create its instance.

ChildPackage has the same name as CorePackage, that's why I initially
tried to access it from my .evl file. But, apparently, I can't access this
package, because it has another namespaceURI than CorePackage and resides
in another .ecore file.

I also think about creating an Epsilon wizard instead of this quick-fix.
But I haven't looked into EWL much, so I'm not sure if it's even possible.
Re: Accessing subpackages in EVL [message #17165 is a reply to message #17079] Thu, 30 April 2009 15:50 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

This makes much sense indeed. I'm working on a patch for this now and
will hopefully release a new interim version later on today.

Cheers,
Dimitris

Yuri G wrote:
> I see, Dimitris, thanks for reply. Let me illustrate my case.
> The metamodel is split into two .ecore files:
>
> <CoreMM.ecore>
> CorePackage : EPackage
> CoreSubPackage : EPackage
> CoreClass : EClass (contains ClassX elements)
> ClassX : EClass (contains references to ClassY)
> ClassY : EClass (abstract)
>
> <ChildMM.ecore>
> ChildPackage : EPackage
> ChildSubPackage : EPackage
> ChildOfY : EClass -> ClassY
>
> Developed GMF editor for CoreClass can draw diagram nodes for ClassX and
> ChildOfY meta-elements.
> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>
> context ClassX {...}
>
> Now I'd like to implement a quick-fix in this constraint which would
> create a ChildOfY node in my diagram and add a reference to it into the
> validated ClassX if needed. But there's no way I can get to ChildOfY
> EClass to create its instance.
>
> ChildPackage has the same name as CorePackage, that's why I initially
> tried to access it from my .evl file. But, apparently, I can't access
> this package, because it has another namespaceURI than CorePackage and
> resides in another .ecore file.
>
> I also think about creating an Epsilon wizard instead of this quick-fix.
> But I haven't looked into EWL much, so I'm not sure if it's even possible.
>
Re: Accessing subpackages in EVL [message #17194 is a reply to message #17165] Thu, 30 April 2009 15:53 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
In the meantime could you please open a new enhancement request about
this in the bugzilla so that we can keep track of this?

Cheers,
Dimitris

Dimitris Kolovos wrote:
> Hi Yuri,
>
> This makes much sense indeed. I'm working on a patch for this now and
> will hopefully release a new interim version later on today.
>
> Cheers,
> Dimitris
>
> Yuri G wrote:
>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>> The metamodel is split into two .ecore files:
>>
>> <CoreMM.ecore>
>> CorePackage : EPackage
>> CoreSubPackage : EPackage
>> CoreClass : EClass (contains ClassX elements)
>> ClassX : EClass (contains references to ClassY)
>> ClassY : EClass (abstract)
>>
>> <ChildMM.ecore>
>> ChildPackage : EPackage
>> ChildSubPackage : EPackage
>> ChildOfY : EClass -> ClassY
>>
>> Developed GMF editor for CoreClass can draw diagram nodes for ClassX
>> and ChildOfY meta-elements.
>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>
>> context ClassX {...}
>>
>> Now I'd like to implement a quick-fix in this constraint which would
>> create a ChildOfY node in my diagram and add a reference to it into
>> the validated ClassX if needed. But there's no way I can get to
>> ChildOfY EClass to create its instance.
>>
>> ChildPackage has the same name as CorePackage, that's why I initially
>> tried to access it from my .evl file. But, apparently, I can't access
>> this package, because it has another namespaceURI than CorePackage and
>> resides in another .ecore file.
>>
>> I also think about creating an Epsilon wizard instead of this
>> quick-fix. But I haven't looked into EWL much, so I'm not sure if it's
>> even possible.
>>
Re: Accessing subpackages in EVL [message #17223 is a reply to message #17165] Thu, 30 April 2009 15:56 Go to previous messageGo to next message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
That's awesome! Looking forward to the patch release.
Re: Accessing subpackages in EVL [message #17249 is a reply to message #17194] Thu, 30 April 2009 16:24 Go to previous messageGo to next message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Sure, done:

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

Dimitris Kolovos wrote:

> In the meantime could you please open a new enhancement request about
> this in the bugzilla so that we can keep track of this?

> Cheers,
> Dimitris

> Dimitris Kolovos wrote:
>> Hi Yuri,
>>
>> This makes much sense indeed. I'm working on a patch for this now and
>> will hopefully release a new interim version later on today.
>>
>> Cheers,
>> Dimitris
>>
>> Yuri G wrote:
>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>> The metamodel is split into two .ecore files:
>>>
>>> <CoreMM.ecore>
>>> CorePackage : EPackage
>>> CoreSubPackage : EPackage
>>> CoreClass : EClass (contains ClassX elements)
>>> ClassX : EClass (contains references to ClassY)
>>> ClassY : EClass (abstract)
>>>
>>> <ChildMM.ecore>
>>> ChildPackage : EPackage
>>> ChildSubPackage : EPackage
>>> ChildOfY : EClass -> ClassY
>>>
>>> Developed GMF editor for CoreClass can draw diagram nodes for ClassX
>>> and ChildOfY meta-elements.
>>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>>
>>> context ClassX {...}
>>>
>>> Now I'd like to implement a quick-fix in this constraint which would
>>> create a ChildOfY node in my diagram and add a reference to it into
>>> the validated ClassX if needed. But there's no way I can get to
>>> ChildOfY EClass to create its instance.
>>>
>>> ChildPackage has the same name as CorePackage, that's why I initially
>>> tried to access it from my .evl file. But, apparently, I can't access
>>> this package, because it has another namespaceURI than CorePackage and
>>> resides in another .ecore file.
>>>
>>> I also think about creating an Epsilon wizard instead of this
>>> quick-fix. But I haven't looked into EWL much, so I'm not sure if it's
>>> even possible.
>>>
Re: Accessing subpackages in EVL [message #17276 is a reply to message #17249] Thu, 30 April 2009 16:55 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Thanks Yuri. I've just uploaded a new interim version
(0.8.5.200904301737) under
http://download.eclipse.org/modeling/gmt/epsilon/interim/. To create a
new ChildOfY you should now add the following line of code before:

_Model.addNamespaceUri('uri-of-ChildPackage');
var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;

(_Model is the implicit name of the currently validated model)

Please let me know if it works for you. If not, I'll give it another go
tomorrow with a clearer mind.

Cheers,
Dimitris

Yuri G wrote:
> Sure, done:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>
> Dimitris Kolovos wrote:
>
>> In the meantime could you please open a new enhancement request about
>> this in the bugzilla so that we can keep track of this?
>
>> Cheers,
>> Dimitris
>
>> Dimitris Kolovos wrote:
>>> Hi Yuri,
>>>
>>> This makes much sense indeed. I'm working on a patch for this now and
>>> will hopefully release a new interim version later on today.
>>>
>>> Cheers,
>>> Dimitris
>>>
>>> Yuri G wrote:
>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>> The metamodel is split into two .ecore files:
>>>>
>>>> <CoreMM.ecore>
>>>> CorePackage : EPackage
>>>> CoreSubPackage : EPackage
>>>> CoreClass : EClass (contains ClassX elements)
>>>> ClassX : EClass (contains references to ClassY)
>>>> ClassY : EClass (abstract)
>>>>
>>>> <ChildMM.ecore>
>>>> ChildPackage : EPackage
>>>> ChildSubPackage : EPackage
>>>> ChildOfY : EClass -> ClassY
>>>>
>>>> Developed GMF editor for CoreClass can draw diagram nodes for ClassX
>>>> and ChildOfY meta-elements.
>>>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>>>
>>>> context ClassX {...}
>>>>
>>>> Now I'd like to implement a quick-fix in this constraint which would
>>>> create a ChildOfY node in my diagram and add a reference to it into
>>>> the validated ClassX if needed. But there's no way I can get to
>>>> ChildOfY EClass to create its instance.
>>>>
>>>> ChildPackage has the same name as CorePackage, that's why I
>>>> initially tried to access it from my .evl file. But, apparently, I
>>>> can't access this package, because it has another namespaceURI than
>>>> CorePackage and resides in another .ecore file.
>>>>
>>>> I also think about creating an Epsilon wizard instead of this
>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure if
>>>> it's even possible.
>>>>
>
>
Re: Accessing subpackages in EVL [message #17353 is a reply to message #17276] Fri, 01 May 2009 07:46 Go to previous messageGo to next message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Hello, Dimitris!

I've just tried the patch, seems not to work with runtime error 'Method
'addNamespaceUri' not found'.

Also I did a search for 'addNamespaceUri' string in the source codes of
the downloaded interim plug-ins and it found nothing.

Dimitris Kolovos wrote:

> Thanks Yuri. I've just uploaded a new interim version
> (0.8.5.200904301737) under
> http://download.eclipse.org/modeling/gmt/epsilon/interim/. To create a
> new ChildOfY you should now add the following line of code before:

> _Model.addNamespaceUri('uri-of-ChildPackage');
> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;

> (_Model is the implicit name of the currently validated model)

> Please let me know if it works for you. If not, I'll give it another go
> tomorrow with a clearer mind.

> Cheers,
> Dimitris

> Yuri G wrote:
>> Sure, done:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>
>> Dimitris Kolovos wrote:
>>
>>> In the meantime could you please open a new enhancement request about
>>> this in the bugzilla so that we can keep track of this?
>>
>>> Cheers,
>>> Dimitris
>>
>>> Dimitris Kolovos wrote:
>>>> Hi Yuri,
>>>>
>>>> This makes much sense indeed. I'm working on a patch for this now and
>>>> will hopefully release a new interim version later on today.
>>>>
>>>> Cheers,
>>>> Dimitris
>>>>
>>>> Yuri G wrote:
>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>> The metamodel is split into two .ecore files:
>>>>>
>>>>> <CoreMM.ecore>
>>>>> CorePackage : EPackage
>>>>> CoreSubPackage : EPackage
>>>>> CoreClass : EClass (contains ClassX elements)
>>>>> ClassX : EClass (contains references to ClassY)
>>>>> ClassY : EClass (abstract)
>>>>>
>>>>> <ChildMM.ecore>
>>>>> ChildPackage : EPackage
>>>>> ChildSubPackage : EPackage
>>>>> ChildOfY : EClass -> ClassY
>>>>>
>>>>> Developed GMF editor for CoreClass can draw diagram nodes for ClassX
>>>>> and ChildOfY meta-elements.
>>>>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>>>>
>>>>> context ClassX {...}
>>>>>
>>>>> Now I'd like to implement a quick-fix in this constraint which would
>>>>> create a ChildOfY node in my diagram and add a reference to it into
>>>>> the validated ClassX if needed. But there's no way I can get to
>>>>> ChildOfY EClass to create its instance.
>>>>>
>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>> initially tried to access it from my .evl file. But, apparently, I
>>>>> can't access this package, because it has another namespaceURI than
>>>>> CorePackage and resides in another .ecore file.
>>>>>
>>>>> I also think about creating an Epsilon wizard instead of this
>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure if
>>>>> it's even possible.
>>>>>
>>
>>
Re: Accessing subpackages in EVL [message #17374 is a reply to message #17353] Fri, 01 May 2009 08:53 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

Sorry about that. The method is actually called addMetamodelUri instead
of addNamespaceUri.

Cheers,
Dimitris

Yuri G wrote:
> Hello, Dimitris!
>
> I've just tried the patch, seems not to work with runtime error 'Method
> 'addNamespaceUri' not found'.
> Also I did a search for 'addNamespaceUri' string in the source codes of
> the downloaded interim plug-ins and it found nothing.
>
> Dimitris Kolovos wrote:
>
>> Thanks Yuri. I've just uploaded a new interim version
>> (0.8.5.200904301737) under
>> http://download.eclipse.org/modeling/gmt/epsilon/interim/. To create a
>> new ChildOfY you should now add the following line of code before:
>
>> _Model.addNamespaceUri('uri-of-ChildPackage');
>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>
>> (_Model is the implicit name of the currently validated model)
>
>> Please let me know if it works for you. If not, I'll give it another
>> go tomorrow with a clearer mind.
>
>> Cheers,
>> Dimitris
>
>> Yuri G wrote:
>>> Sure, done:
>>>
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>
>>> Dimitris Kolovos wrote:
>>>
>>>> In the meantime could you please open a new enhancement request
>>>> about this in the bugzilla so that we can keep track of this?
>>>
>>>> Cheers,
>>>> Dimitris
>>>
>>>> Dimitris Kolovos wrote:
>>>>> Hi Yuri,
>>>>>
>>>>> This makes much sense indeed. I'm working on a patch for this now
>>>>> and will hopefully release a new interim version later on today.
>>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>>
>>>>> Yuri G wrote:
>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>> The metamodel is split into two .ecore files:
>>>>>>
>>>>>> <CoreMM.ecore>
>>>>>> CorePackage : EPackage
>>>>>> CoreSubPackage : EPackage
>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>> ClassY : EClass (abstract)
>>>>>>
>>>>>> <ChildMM.ecore>
>>>>>> ChildPackage : EPackage
>>>>>> ChildSubPackage : EPackage
>>>>>> ChildOfY : EClass -> ClassY
>>>>>>
>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>> ClassX and ChildOfY meta-elements.
>>>>>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>>>>>
>>>>>> context ClassX {...}
>>>>>>
>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>> would create a ChildOfY node in my diagram and add a reference to
>>>>>> it into the validated ClassX if needed. But there's no way I can
>>>>>> get to ChildOfY EClass to create its instance.
>>>>>>
>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>> initially tried to access it from my .evl file. But, apparently, I
>>>>>> can't access this package, because it has another namespaceURI
>>>>>> than CorePackage and resides in another .ecore file.
>>>>>>
>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure if
>>>>>> it's even possible.
>>>>>>
>>>
>>>
>
>
Re: Accessing subpackages in EVL [message #17842 is a reply to message #17374] Fri, 01 May 2009 12:36 Go to previous messageGo to next message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Hi, Dimitris. Thank you for reply!

addMetamodelUri almost works. Now my constraint can see the classes from
the added EPackage. So code like this:

ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints class name

works just fine. Also now I can create instances of ChildOfY in the DO
block of FIX statement of the constraint:

var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
childOfY.println(); -- ok

But I can see changes to the diagram only after I refresh it with pressing
F5 which is not very convenient.

Also writing the same code in some operation throws an exception
"java.lang.IllegalStateException: Cannot modify resource set without a
write transaction". Though if I press F5 after that, the new node ChildOfY
will be shown in the diagram.

Dimitris Kolovos wrote:

> Hi Yuri,

> Sorry about that. The method is actually called addMetamodelUri instead
> of addNamespaceUri.

> Cheers,
> Dimitris

> Yuri G wrote:
>> Hello, Dimitris!
>>
>> I've just tried the patch, seems not to work with runtime error 'Method
>> 'addNamespaceUri' not found'.
>> Also I did a search for 'addNamespaceUri' string in the source codes of
>> the downloaded interim plug-ins and it found nothing.
>>
>> Dimitris Kolovos wrote:
>>
>>> Thanks Yuri. I've just uploaded a new interim version
>>> (0.8.5.200904301737) under
>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/. To create a
>>> new ChildOfY you should now add the following line of code before:
>>
>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>
>>> (_Model is the implicit name of the currently validated model)
>>
>>> Please let me know if it works for you. If not, I'll give it another
>>> go tomorrow with a clearer mind.
>>
>>> Cheers,
>>> Dimitris
>>
>>> Yuri G wrote:
>>>> Sure, done:
>>>>
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>
>>>> Dimitris Kolovos wrote:
>>>>
>>>>> In the meantime could you please open a new enhancement request
>>>>> about this in the bugzilla so that we can keep track of this?
>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>
>>>>> Dimitris Kolovos wrote:
>>>>>> Hi Yuri,
>>>>>>
>>>>>> This makes much sense indeed. I'm working on a patch for this now
>>>>>> and will hopefully release a new interim version later on today.
>>>>>>
>>>>>> Cheers,
>>>>>> Dimitris
>>>>>>
>>>>>> Yuri G wrote:
>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>
>>>>>>> <CoreMM.ecore>
>>>>>>> CorePackage : EPackage
>>>>>>> CoreSubPackage : EPackage
>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>> ClassY : EClass (abstract)
>>>>>>>
>>>>>>> <ChildMM.ecore>
>>>>>>> ChildPackage : EPackage
>>>>>>> ChildSubPackage : EPackage
>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>
>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>>> ClassX and ChildOfY meta-elements.
>>>>>>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>>>>>>
>>>>>>> context ClassX {...}
>>>>>>>
>>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>>> would create a ChildOfY node in my diagram and add a reference to
>>>>>>> it into the validated ClassX if needed. But there's no way I can
>>>>>>> get to ChildOfY EClass to create its instance.
>>>>>>>
>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>> initially tried to access it from my .evl file. But, apparently, I
>>>>>>> can't access this package, because it has another namespaceURI
>>>>>>> than CorePackage and resides in another .ecore file.
>>>>>>>
>>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure if
>>>>>>> it's even possible.
>>>>>>>
>>>>
>>>>
>>
>>
Re: Accessing subpackages in EVL [message #17852 is a reply to message #17842] Fri, 01 May 2009 12:51 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

Looking into the F5 and exception issues now..

Cheers,
Dimitris

Yuri G wrote:
> Hi, Dimitris. Thank you for reply!
>
> addMetamodelUri almost works. Now my constraint can see the classes from
> the added EPackage. So code like this:
>
> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints class name
>
> works just fine. Also now I can create instances of ChildOfY in the DO
> block of FIX statement of the constraint:
>
> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
> childOfY.println(); -- ok
>
> But I can see changes to the diagram only after I refresh it with
> pressing F5 which is not very convenient.
>
> Also writing the same code in some operation throws an exception
> "java.lang.IllegalStateException: Cannot modify resource set without a
> write transaction". Though if I press F5 after that, the new node
> ChildOfY will be shown in the diagram.
>
> Dimitris Kolovos wrote:
>
>> Hi Yuri,
>
>> Sorry about that. The method is actually called addMetamodelUri
>> instead of addNamespaceUri.
>
>> Cheers,
>> Dimitris
>
>> Yuri G wrote:
>>> Hello, Dimitris!
>>>
>>> I've just tried the patch, seems not to work with runtime error
>>> 'Method 'addNamespaceUri' not found'.
>>> Also I did a search for 'addNamespaceUri' string in the source codes
>>> of the downloaded interim plug-ins and it found nothing.
>>>
>>> Dimitris Kolovos wrote:
>>>
>>>> Thanks Yuri. I've just uploaded a new interim version
>>>> (0.8.5.200904301737) under
>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/. To create
>>>> a new ChildOfY you should now add the following line of code before:
>>>
>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>
>>>> (_Model is the implicit name of the currently validated model)
>>>
>>>> Please let me know if it works for you. If not, I'll give it another
>>>> go tomorrow with a clearer mind.
>>>
>>>> Cheers,
>>>> Dimitris
>>>
>>>> Yuri G wrote:
>>>>> Sure, done:
>>>>>
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>
>>>>> Dimitris Kolovos wrote:
>>>>>
>>>>>> In the meantime could you please open a new enhancement request
>>>>>> about this in the bugzilla so that we can keep track of this?
>>>>>
>>>>>> Cheers,
>>>>>> Dimitris
>>>>>
>>>>>> Dimitris Kolovos wrote:
>>>>>>> Hi Yuri,
>>>>>>>
>>>>>>> This makes much sense indeed. I'm working on a patch for this now
>>>>>>> and will hopefully release a new interim version later on today.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Dimitris
>>>>>>>
>>>>>>> Yuri G wrote:
>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>
>>>>>>>> <CoreMM.ecore>
>>>>>>>> CorePackage : EPackage
>>>>>>>> CoreSubPackage : EPackage
>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>
>>>>>>>> <ChildMM.ecore>
>>>>>>>> ChildPackage : EPackage
>>>>>>>> ChildSubPackage : EPackage
>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>
>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>>>> ClassX and ChildOfY meta-elements.
>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>> namespaceURI:
>>>>>>>>
>>>>>>>> context ClassX {...}
>>>>>>>>
>>>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>>>> would create a ChildOfY node in my diagram and add a reference
>>>>>>>> to it into the validated ClassX if needed. But there's no way I
>>>>>>>> can get to ChildOfY EClass to create its instance.
>>>>>>>>
>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>> initially tried to access it from my .evl file. But, apparently,
>>>>>>>> I can't access this package, because it has another namespaceURI
>>>>>>>> than CorePackage and resides in another .ecore file.
>>>>>>>>
>>>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure
>>>>>>>> if it's even possible.
>>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
Re: Accessing subpackages in EVL [message #17867 is a reply to message #17852] Fri, 01 May 2009 13:20 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

Unfortunately, I'm not able to reproduce this with the mindmap editor.
Could you please send me a copy of your plugins (or a minimal example
that reproduces the problem) so that I can test more?

Is this only happening only when you are trying to instantiate classes
from the added metamodel or for all classes?

Cheers,
Dimitris

Dimitris Kolovos wrote:
> Hi Yuri,
>
> Looking into the F5 and exception issues now..
>
> Cheers,
> Dimitris
>
> Yuri G wrote:
>> Hi, Dimitris. Thank you for reply!
>>
>> addMetamodelUri almost works. Now my constraint can see the classes
>> from the added EPackage. So code like this:
>>
>> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints class
>> name
>>
>> works just fine. Also now I can create instances of ChildOfY in the DO
>> block of FIX statement of the constraint:
>>
>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>> childOfY.println(); -- ok
>>
>> But I can see changes to the diagram only after I refresh it with
>> pressing F5 which is not very convenient.
>>
>> Also writing the same code in some operation throws an exception
>> "java.lang.IllegalStateException: Cannot modify resource set without a
>> write transaction". Though if I press F5 after that, the new node
>> ChildOfY will be shown in the diagram.
>>
>> Dimitris Kolovos wrote:
>>
>>> Hi Yuri,
>>
>>> Sorry about that. The method is actually called addMetamodelUri
>>> instead of addNamespaceUri.
>>
>>> Cheers,
>>> Dimitris
>>
>>> Yuri G wrote:
>>>> Hello, Dimitris!
>>>>
>>>> I've just tried the patch, seems not to work with runtime error
>>>> 'Method 'addNamespaceUri' not found'.
>>>> Also I did a search for 'addNamespaceUri' string in the source codes
>>>> of the downloaded interim plug-ins and it found nothing.
>>>>
>>>> Dimitris Kolovos wrote:
>>>>
>>>>> Thanks Yuri. I've just uploaded a new interim version
>>>>> (0.8.5.200904301737) under
>>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/. To
>>>>> create a new ChildOfY you should now add the following line of code
>>>>> before:
>>>>
>>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>
>>>>> (_Model is the implicit name of the currently validated model)
>>>>
>>>>> Please let me know if it works for you. If not, I'll give it
>>>>> another go tomorrow with a clearer mind.
>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>
>>>>> Yuri G wrote:
>>>>>> Sure, done:
>>>>>>
>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>>
>>>>>> Dimitris Kolovos wrote:
>>>>>>
>>>>>>> In the meantime could you please open a new enhancement request
>>>>>>> about this in the bugzilla so that we can keep track of this?
>>>>>>
>>>>>>> Cheers,
>>>>>>> Dimitris
>>>>>>
>>>>>>> Dimitris Kolovos wrote:
>>>>>>>> Hi Yuri,
>>>>>>>>
>>>>>>>> This makes much sense indeed. I'm working on a patch for this
>>>>>>>> now and will hopefully release a new interim version later on
>>>>>>>> today.
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Dimitris
>>>>>>>>
>>>>>>>> Yuri G wrote:
>>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>>
>>>>>>>>> <CoreMM.ecore>
>>>>>>>>> CorePackage : EPackage
>>>>>>>>> CoreSubPackage : EPackage
>>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>>
>>>>>>>>> <ChildMM.ecore>
>>>>>>>>> ChildPackage : EPackage
>>>>>>>>> ChildSubPackage : EPackage
>>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>>
>>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>>>>> ClassX and ChildOfY meta-elements.
>>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>>> namespaceURI:
>>>>>>>>>
>>>>>>>>> context ClassX {...}
>>>>>>>>>
>>>>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>>>>> would create a ChildOfY node in my diagram and add a reference
>>>>>>>>> to it into the validated ClassX if needed. But there's no way I
>>>>>>>>> can get to ChildOfY EClass to create its instance.
>>>>>>>>>
>>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>>> initially tried to access it from my .evl file. But,
>>>>>>>>> apparently, I can't access this package, because it has another
>>>>>>>>> namespaceURI than CorePackage and resides in another .ecore file.
>>>>>>>>>
>>>>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure
>>>>>>>>> if it's even possible.
>>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
Re: Accessing subpackages in EVL [message #17881 is a reply to message #17867] Fri, 01 May 2009 18:31 Go to previous messageGo to next message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Hi Dimitris,

Well, I guess I found out that pressing F5 is needed because I didn't
actually add the created instance of ChildOfY to the validated ClassX. Now
it shows in the diagram immediately. So this issue is solved.

Also if I just create the variable of type ClassX and don't "insert" into
the diagram's domain element it would not be shown either (until I press
F5). Though if I save the diagram (even without refreshing it), this
instance of ClassX would be added to the model file, but as an "outside"
head XMI node like this:

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI ....>
<CoreClass/> // this is diagram node
<ClassX/> // this variable was defined in the quick-fix
</xmi:XMI>

I'm going to test addMetamodelUri on the weekend more and write you back
if the problem with exception persists or anything (I've just tried to
reproduce the exception, unsuccessfully...).

Thank for you very much for your replies and the patch, Dimitris!

Regards, Yuri.

Dimitris Kolovos wrote:

> Hi Yuri,

> Unfortunately, I'm not able to reproduce this with the mindmap editor.
> Could you please send me a copy of your plugins (or a minimal example
> that reproduces the problem) so that I can test more?

> Is this only happening only when you are trying to instantiate classes
> from the added metamodel or for all classes?

> Cheers,
> Dimitris

> Dimitris Kolovos wrote:
>> Hi Yuri,
>>
>> Looking into the F5 and exception issues now..
>>
>> Cheers,
>> Dimitris
>>
>> Yuri G wrote:
>>> Hi, Dimitris. Thank you for reply!
>>>
>>> addMetamodelUri almost works. Now my constraint can see the classes
>>> from the added EPackage. So code like this:
>>>
>>> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints class
>>> name
>>>
>>> works just fine. Also now I can create instances of ChildOfY in the DO
>>> block of FIX statement of the constraint:
>>>
>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>> childOfY.println(); -- ok
>>>
>>> But I can see changes to the diagram only after I refresh it with
>>> pressing F5 which is not very convenient.
>>>
>>> Also writing the same code in some operation throws an exception
>>> "java.lang.IllegalStateException: Cannot modify resource set without a
>>> write transaction". Though if I press F5 after that, the new node
>>> ChildOfY will be shown in the diagram.
>>>
>>> Dimitris Kolovos wrote:
>>>
>>>> Hi Yuri,
>>>
>>>> Sorry about that. The method is actually called addMetamodelUri
>>>> instead of addNamespaceUri.
>>>
>>>> Cheers,
>>>> Dimitris
>>>
>>>> Yuri G wrote:
>>>>> Hello, Dimitris!
>>>>>
>>>>> I've just tried the patch, seems not to work with runtime error
>>>>> 'Method 'addNamespaceUri' not found'.
>>>>> Also I did a search for 'addNamespaceUri' string in the source codes
>>>>> of the downloaded interim plug-ins and it found nothing.
>>>>>
>>>>> Dimitris Kolovos wrote:
>>>>>
>>>>>> Thanks Yuri. I've just uploaded a new interim version
>>>>>> (0.8.5.200904301737) under
>>>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/. To
>>>>>> create a new ChildOfY you should now add the following line of code
>>>>>> before:
>>>>>
>>>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>>
>>>>>> (_Model is the implicit name of the currently validated model)
>>>>>
>>>>>> Please let me know if it works for you. If not, I'll give it
>>>>>> another go tomorrow with a clearer mind.
>>>>>
>>>>>> Cheers,
>>>>>> Dimitris
>>>>>
>>>>>> Yuri G wrote:
>>>>>>> Sure, done:
>>>>>>>
>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>>>
>>>>>>> Dimitris Kolovos wrote:
>>>>>>>
>>>>>>>> In the meantime could you please open a new enhancement request
>>>>>>>> about this in the bugzilla so that we can keep track of this?
>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Dimitris
>>>>>>>
>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>> Hi Yuri,
>>>>>>>>>
>>>>>>>>> This makes much sense indeed. I'm working on a patch for this
>>>>>>>>> now and will hopefully release a new interim version later on
>>>>>>>>> today.
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Dimitris
>>>>>>>>>
>>>>>>>>> Yuri G wrote:
>>>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>>>
>>>>>>>>>> <CoreMM.ecore>
>>>>>>>>>> CorePackage : EPackage
>>>>>>>>>> CoreSubPackage : EPackage
>>>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>>>
>>>>>>>>>> <ChildMM.ecore>
>>>>>>>>>> ChildPackage : EPackage
>>>>>>>>>> ChildSubPackage : EPackage
>>>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>>>
>>>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>>>>>> ClassX and ChildOfY meta-elements.
>>>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>>>> namespaceURI:
>>>>>>>>>>
>>>>>>>>>> context ClassX {...}
>>>>>>>>>>
>>>>>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>>>>>> would create a ChildOfY node in my diagram and add a reference
>>>>>>>>>> to it into the validated ClassX if needed. But there's no way I
>>>>>>>>>> can get to ChildOfY EClass to create its instance.
>>>>>>>>>>
>>>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>>>> initially tried to access it from my .evl file. But,
>>>>>>>>>> apparently, I can't access this package, because it has another
>>>>>>>>>> namespaceURI than CorePackage and resides in another .ecore file.
>>>>>>>>>>
>>>>>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure
>>>>>>>>>> if it's even possible.
>>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
Re: Accessing subpackages in EVL [message #17894 is a reply to message #17881] Sun, 03 May 2009 07:38 Go to previous messageGo to next message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Hello, Dimitris,

I think I've found the sources of the reported errors. They're not caused
by using addMetamodelUri().

1. java.lang.IllegalState exception was caused by instantiating metamodel
element in the operation which is called from the 'check' block. Example
for the Mindmap example:

context Map {
constraint Test {
check : poo()
message : 'test!'
}
}

operation poo() : Boolean {
var t : new Topic; -- exception here
return false;
}

Shall I create a bug-report?

2. About the problem with need to refresh the diagram after quick-fix. It
seems that quick fixes work correctly in most cases (i.e. the user doesn't
have to refresh nor re-initialize the diagram file manually).

Though I've sent you a minimal project which reproduces such behavior. I
have the same case in my own project. There's a diagram link used to
represent a containment feature of class A. Class A contains instances of
class B. If in the EVL quick-fix I try to create an instance of B and add
it to the validated A, it wouldn't be shown on the diagram immediately.
Though the changes would be saved to the model file. Any suggestions?

Regards, Yuri

Yuri G wrote:

> Hi Dimitris,

> Well, I guess I found out that pressing F5 is needed because I didn't
> actually add the created instance of ChildOfY to the validated ClassX. Now
> it shows in the diagram immediately. So this issue is solved.

> Also if I just create the variable of type ClassX and don't "insert" into
> the diagram's domain element it would not be shown either (until I press
> F5). Though if I save the diagram (even without refreshing it), this
> instance of ClassX would be added to the model file, but as an "outside"
> head XMI node like this:

> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI ....>
> <CoreClass/> // this is diagram node
> <ClassX/> // this variable was defined in the quick-fix
> </xmi:XMI>

> I'm going to test addMetamodelUri on the weekend more and write you back
> if the problem with exception persists or anything (I've just tried to
> reproduce the exception, unsuccessfully...).

> Thank for you very much for your replies and the patch, Dimitris!

> Regards, Yuri.

> Dimitris Kolovos wrote:

>> Hi Yuri,

>> Unfortunately, I'm not able to reproduce this with the mindmap editor.
>> Could you please send me a copy of your plugins (or a minimal example
>> that reproduces the problem) so that I can test more?

>> Is this only happening only when you are trying to instantiate classes
>> from the added metamodel or for all classes?

>> Cheers,
>> Dimitris

>> Dimitris Kolovos wrote:
>>> Hi Yuri,
>>>
>>> Looking into the F5 and exception issues now..
>>>
>>> Cheers,
>>> Dimitris
>>>
>>> Yuri G wrote:
>>>> Hi, Dimitris. Thank you for reply!
>>>>
>>>> addMetamodelUri almost works. Now my constraint can see the classes
>>>> from the added EPackage. So code like this:
>>>>
>>>> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints class
>>>> name
>>>>
>>>> works just fine. Also now I can create instances of ChildOfY in the DO
>>>> block of FIX statement of the constraint:
>>>>
>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>> childOfY.println(); -- ok
>>>>
>>>> But I can see changes to the diagram only after I refresh it with
>>>> pressing F5 which is not very convenient.
>>>>
>>>> Also writing the same code in some operation throws an exception
>>>> "java.lang.IllegalStateException: Cannot modify resource set without a
>>>> write transaction". Though if I press F5 after that, the new node
>>>> ChildOfY will be shown in the diagram.
>>>>
>>>> Dimitris Kolovos wrote:
>>>>
>>>>> Hi Yuri,
>>>>
>>>>> Sorry about that. The method is actually called addMetamodelUri
>>>>> instead of addNamespaceUri.
>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>
>>>>> Yuri G wrote:
>>>>>> Hello, Dimitris!
>>>>>>
>>>>>> I've just tried the patch, seems not to work with runtime error
>>>>>> 'Method 'addNamespaceUri' not found'.
>>>>>> Also I did a search for 'addNamespaceUri' string in the source codes
>>>>>> of the downloaded interim plug-ins and it found nothing.
>>>>>>
>>>>>> Dimitris Kolovos wrote:
>>>>>>
>>>>>>> Thanks Yuri. I've just uploaded a new interim version
>>>>>>> (0.8.5.200904301737) under
>>>>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/. To
>>>>>>> create a new ChildOfY you should now add the following line of code
>>>>>>> before:
>>>>>>
>>>>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>>>
>>>>>>> (_Model is the implicit name of the currently validated model)
>>>>>>
>>>>>>> Please let me know if it works for you. If not, I'll give it
>>>>>>> another go tomorrow with a clearer mind.
>>>>>>
>>>>>>> Cheers,
>>>>>>> Dimitris
>>>>>>
>>>>>>> Yuri G wrote:
>>>>>>>> Sure, done:
>>>>>>>>
>>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>>>>
>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>
>>>>>>>>> In the meantime could you please open a new enhancement request
>>>>>>>>> about this in the bugzilla so that we can keep track of this?
>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Dimitris
>>>>>>>>
>>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>>> Hi Yuri,
>>>>>>>>>>
>>>>>>>>>> This makes much sense indeed. I'm working on a patch for this
>>>>>>>>>> now and will hopefully release a new interim version later on
>>>>>>>>>> today.
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>> Dimitris
>>>>>>>>>>
>>>>>>>>>> Yuri G wrote:
>>>>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>>>>
>>>>>>>>>>> <CoreMM.ecore>
>>>>>>>>>>> CorePackage : EPackage
>>>>>>>>>>> CoreSubPackage : EPackage
>>>>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>>>>
>>>>>>>>>>> <ChildMM.ecore>
>>>>>>>>>>> ChildPackage : EPackage
>>>>>>>>>>> ChildSubPackage : EPackage
>>>>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>>>>
>>>>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>>>>>>> ClassX and ChildOfY meta-elements.
>>>>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>>>>> namespaceURI:
>>>>>>>>>>>
>>>>>>>>>>> context ClassX {...}
>>>>>>>>>>>
>>>>>>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>>>>>>> would create a ChildOfY node in my diagram and add a reference
>>>>>>>>>>> to it into the validated ClassX if needed. But there's no way I
>>>>>>>>>>> can get to ChildOfY EClass to create its instance.
>>>>>>>>>>>
>>>>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>>>>> initially tried to access it from my .evl file. But,
>>>>>>>>>>> apparently, I can't access this package, because it has another
>>>>>>>>>>> namespaceURI than CorePackage and resides in another .ecore file.
>>>>>>>>>>>
>>>>>>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure
>>>>>>>>>>> if it's even possible.
>>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
Re: Accessing subpackages in EVL [message #17908 is a reply to message #17894] Thu, 07 May 2009 16:06 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

Apologies for the late response. It's been a very busy week. Please see
comments below:

Yuri G wrote:
> Hello, Dimitris,
>
> I think I've found the sources of the reported errors. They're not
> caused by using addMetamodelUri().
>
> 1. java.lang.IllegalState exception was caused by instantiating
> metamodel element in the operation which is called from the 'check'
> block. Example for the Mindmap example:
>
> context Map {
> constraint Test {
> check : poo()
> message : 'test!'
> }
> }
>
> operation poo() : Boolean {
> var t : new Topic; -- exception here
> return false;
> }
>
> Shall I create a bug-report?

Is there any specific reason why you'd want to create objects in the
check part? By default the check part runs in read-only mode (hence the
exception) but again if you have a good reason I'm happy to change this...

>
> 2. About the problem with need to refresh the diagram after quick-fix.
> It seems that quick fixes work correctly in most cases (i.e. the user
> doesn't have to refresh nor re-initialize the diagram file manually).
>
> Though I've sent you a minimal project which reproduces such behavior. I
> have the same case in my own project. There's a diagram link used to
> represent a containment feature of class A. Class A contains instances
> of class B. If in the EVL quick-fix I try to create an instance of B and
> add it to the validated A, it wouldn't be shown on the diagram
> immediately. Though the changes would be saved to the model file. Any
> suggestions?

I'll check with the example you've sent me and get back to you on this
shortly.

>
> Regards, Yuri
>

Cheers,
Dimitris
> Yuri G wrote:
>
>> Hi Dimitris,
>
>> Well, I guess I found out that pressing F5 is needed because I didn't
>> actually add the created instance of ChildOfY to the validated ClassX.
>> Now it shows in the diagram immediately. So this issue is solved.
>
>> Also if I just create the variable of type ClassX and don't "insert"
>> into the diagram's domain element it would not be shown either (until
>> I press F5). Though if I save the diagram (even without refreshing
>> it), this instance of ClassX would be added to the model file, but as
>> an "outside" head XMI node like this:
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xmi:XMI ....>
>> <CoreClass/> // this is diagram node
>> <ClassX/> // this variable was defined in the quick-fix
>> </xmi:XMI>
>
>> I'm going to test addMetamodelUri on the weekend more and write you
>> back if the problem with exception persists or anything (I've just
>> tried to reproduce the exception, unsuccessfully...).
>
>> Thank for you very much for your replies and the patch, Dimitris!
>
>> Regards, Yuri.
>
>> Dimitris Kolovos wrote:
>
>>> Hi Yuri,
>
>>> Unfortunately, I'm not able to reproduce this with the mindmap
>>> editor. Could you please send me a copy of your plugins (or a minimal
>>> example that reproduces the problem) so that I can test more?
>
>>> Is this only happening only when you are trying to instantiate
>>> classes from the added metamodel or for all classes?
>
>>> Cheers,
>>> Dimitris
>
>>> Dimitris Kolovos wrote:
>>>> Hi Yuri,
>>>>
>>>> Looking into the F5 and exception issues now..
>>>>
>>>> Cheers,
>>>> Dimitris
>>>>
>>>> Yuri G wrote:
>>>>> Hi, Dimitris. Thank you for reply!
>>>>>
>>>>> addMetamodelUri almost works. Now my constraint can see the classes
>>>>> from the added EPackage. So code like this:
>>>>>
>>>>> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints
>>>>> class name
>>>>>
>>>>> works just fine. Also now I can create instances of ChildOfY in the
>>>>> DO block of FIX statement of the constraint:
>>>>>
>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>> childOfY.println(); -- ok
>>>>>
>>>>> But I can see changes to the diagram only after I refresh it with
>>>>> pressing F5 which is not very convenient.
>>>>>
>>>>> Also writing the same code in some operation throws an exception
>>>>> "java.lang.IllegalStateException: Cannot modify resource set
>>>>> without a write transaction". Though if I press F5 after that, the
>>>>> new node ChildOfY will be shown in the diagram.
>>>>>
>>>>> Dimitris Kolovos wrote:
>>>>>
>>>>>> Hi Yuri,
>>>>>
>>>>>> Sorry about that. The method is actually called addMetamodelUri
>>>>>> instead of addNamespaceUri.
>>>>>
>>>>>> Cheers,
>>>>>> Dimitris
>>>>>
>>>>>> Yuri G wrote:
>>>>>>> Hello, Dimitris!
>>>>>>>
>>>>>>> I've just tried the patch, seems not to work with runtime error
>>>>>>> 'Method 'addNamespaceUri' not found'.
>>>>>>> Also I did a search for 'addNamespaceUri' string in the source
>>>>>>> codes of the downloaded interim plug-ins and it found nothing.
>>>>>>>
>>>>>>> Dimitris Kolovos wrote:
>>>>>>>
>>>>>>>> Thanks Yuri. I've just uploaded a new interim version
>>>>>>>> (0.8.5.200904301737) under
>>>>>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/. To
>>>>>>>> create a new ChildOfY you should now add the following line of
>>>>>>>> code before:
>>>>>>>
>>>>>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>>>>
>>>>>>>> (_Model is the implicit name of the currently validated model)
>>>>>>>
>>>>>>>> Please let me know if it works for you. If not, I'll give it
>>>>>>>> another go tomorrow with a clearer mind.
>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Dimitris
>>>>>>>
>>>>>>>> Yuri G wrote:
>>>>>>>>> Sure, done:
>>>>>>>>>
>>>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>>>>>
>>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>>
>>>>>>>>>> In the meantime could you please open a new enhancement
>>>>>>>>>> request about this in the bugzilla so that we can keep track
>>>>>>>>>> of this?
>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>> Dimitris
>>>>>>>>>
>>>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>>>> Hi Yuri,
>>>>>>>>>>>
>>>>>>>>>>> This makes much sense indeed. I'm working on a patch for this
>>>>>>>>>>> now and will hopefully release a new interim version later on
>>>>>>>>>>> today.
>>>>>>>>>>>
>>>>>>>>>>> Cheers,
>>>>>>>>>>> Dimitris
>>>>>>>>>>>
>>>>>>>>>>> Yuri G wrote:
>>>>>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>>>>>
>>>>>>>>>>>> <CoreMM.ecore>
>>>>>>>>>>>> CorePackage : EPackage
>>>>>>>>>>>> CoreSubPackage : EPackage
>>>>>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>>>>>
>>>>>>>>>>>> <ChildMM.ecore>
>>>>>>>>>>>> ChildPackage : EPackage
>>>>>>>>>>>> ChildSubPackage : EPackage
>>>>>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>>>>>
>>>>>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes
>>>>>>>>>>>> for ClassX and ChildOfY meta-elements.
>>>>>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>>>>>> namespaceURI:
>>>>>>>>>>>>
>>>>>>>>>>>> context ClassX {...}
>>>>>>>>>>>>
>>>>>>>>>>>> Now I'd like to implement a quick-fix in this constraint
>>>>>>>>>>>> which would create a ChildOfY node in my diagram and add a
>>>>>>>>>>>> reference to it into the validated ClassX if needed. But
>>>>>>>>>>>> there's no way I can get to ChildOfY EClass to create its
>>>>>>>>>>>> instance.
>>>>>>>>>>>>
>>>>>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>>>>>> initially tried to access it from my .evl file. But,
>>>>>>>>>>>> apparently, I can't access this package, because it has
>>>>>>>>>>>> another namespaceURI than CorePackage and resides in another
>>>>>>>>>>>> .ecore file.
>>>>>>>>>>>>
>>>>>>>>>>>> I also think about creating an Epsilon wizard instead of
>>>>>>>>>>>> this quick-fix. But I haven't looked into EWL much, so I'm
>>>>>>>>>>>> not sure if it's even possible.
>>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>
>
>
Re: Accessing subpackages in EVL [message #17922 is a reply to message #17908] Thu, 07 May 2009 16:32 Go to previous message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Dimitris Kolovos wrote:

> Hi Yuri,

> Apologies for the late response. It's been a very busy week.

Sure, no problem.

> Is there any specific reason why you'd want to create objects in the
> check part? By default the check part runs in read-only mode (hence the
> exception) but again if you have a good reason I'm happy to change this...

I see. Initially I instantiated an object in check part by accident. I
don't really need such functionality in my project at the moment. Though I
don't see much reason against such functionality except accidental
modification of the validated node (to prevent errors similar to writing
if(a=b) instead of if(a==b) in C). This feature can be even used to
automatically perform quick-fixes from the check block without need for
user to go to the context menu (for example if the mistake is
simple/obvious and doesn't need user's prompt). Or there can be some
Checker object instantiated for the validation of the selected node. Or it
could be a MetricCalculator class created during validation of a Class
node in UML diagram. Just some ideas off the top of my head.

> I'll check with the example you've sent me and get back to you on this
> shortly.

Thank you very much, looking forward to this.


>> Yuri G wrote:
>>
>>> Hi Dimitris,
>>
>>> Well, I guess I found out that pressing F5 is needed because I didn't
>>> actually add the created instance of ChildOfY to the validated ClassX.
>>> Now it shows in the diagram immediately. So this issue is solved.
>>
>>> Also if I just create the variable of type ClassX and don't "insert"
>>> into the diagram's domain element it would not be shown either (until
>>> I press F5). Though if I save the diagram (even without refreshing
>>> it), this instance of ClassX would be added to the model file, but as
>>> an "outside" head XMI node like this:
>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xmi:XMI ....>
>>> <CoreClass/> // this is diagram node
>>> <ClassX/> // this variable was defined in the quick-fix
>>> </xmi:XMI>
>>
>>> I'm going to test addMetamodelUri on the weekend more and write you
>>> back if the problem with exception persists or anything (I've just
>>> tried to reproduce the exception, unsuccessfully...).
>>
>>> Thank for you very much for your replies and the patch, Dimitris!
>>
>>> Regards, Yuri.
>>
>>> Dimitris Kolovos wrote:
>>
>>>> Hi Yuri,
>>
>>>> Unfortunately, I'm not able to reproduce this with the mindmap
>>>> editor. Could you please send me a copy of your plugins (or a minimal
>>>> example that reproduces the problem) so that I can test more?
>>
>>>> Is this only happening only when you are trying to instantiate
>>>> classes from the added metamodel or for all classes?
>>
>>>> Cheers,
>>>> Dimitris
>>
>>>> Dimitris Kolovos wrote:
>>>>> Hi Yuri,
>>>>>
>>>>> Looking into the F5 and exception issues now..
>>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>>
>>>>> Yuri G wrote:
>>>>>> Hi, Dimitris. Thank you for reply!
>>>>>>
>>>>>> addMetamodelUri almost works. Now my constraint can see the classes
>>>>>> from the added EPackage. So code like this:
>>>>>>
>>>>>> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints
>>>>>> class name
>>>>>>
>>>>>> works just fine. Also now I can create instances of ChildOfY in the
>>>>>> DO block of FIX statement of the constraint:
>>>>>>
>>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>>> childOfY.println(); -- ok
>>>>>>
>>>>>> But I can see changes to the diagram only after I refresh it with
>>>>>> pressing F5 which is not very convenient.
>>>>>>
>>>>>> Also writing the same code in some operation throws an exception
>>>>>> "java.lang.IllegalStateException: Cannot modify resource set
>>>>>> without a write transaction". Though if I press F5 after that, the
>>>>>> new node ChildOfY will be shown in the diagram.
>>>>>>
>>>>>> Dimitris Kolovos wrote:
>>>>>>
>>>>>>> Hi Yuri,
>>>>>>
>>>>>>> Sorry about that. The method is actually called addMetamodelUri
>>>>>>> instead of addNamespaceUri.
>>>>>>
>>>>>>> Cheers,
>>>>>>> Dimitris
>>>>>>
>>>>>>> Yuri G wrote:
>>>>>>>> Hello, Dimitris!
>>>>>>>>
>>>>>>>> I've just tried the patch, seems not to work with runtime error
>>>>>>>> 'Method 'addNamespaceUri' not found'.
>>>>>>>> Also I did a search for 'addNamespaceUri' string in the source
>>>>>>>> codes of the downloaded interim plug-ins and it found nothing.
>>>>>>>>
>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>
>>>>>>>>> Thanks Yuri. I've just uploaded a new interim version
>>>>>>>>> (0.8.5.200904301737) under
>>>>>>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/. To
>>>>>>>>> create a new ChildOfY you should now add the following line of
>>>>>>>>> code before:
>>>>>>>>
>>>>>>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>>>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>>>>>
>>>>>>>>> (_Model is the implicit name of the currently validated model)
>>>>>>>>
>>>>>>>>> Please let me know if it works for you. If not, I'll give it
>>>>>>>>> another go tomorrow with a clearer mind.
>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Dimitris
>>>>>>>>
>>>>>>>>> Yuri G wrote:
>>>>>>>>>> Sure, done:
>>>>>>>>>>
>>>>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>>>>>>
>>>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>>>
>>>>>>>>>>> In the meantime could you please open a new enhancement
>>>>>>>>>>> request about this in the bugzilla so that we can keep track
>>>>>>>>>>> of this?
>>>>>>>>>>
>>>>>>>>>>> Cheers,
>>>>>>>>>>> Dimitris
>>>>>>>>>>
>>>>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>>>>> Hi Yuri,
>>>>>>>>>>>>
>>>>>>>>>>>> This makes much sense indeed. I'm working on a patch for this
>>>>>>>>>>>> now and will hopefully release a new interim version later on
>>>>>>>>>>>> today.
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers,
>>>>>>>>>>>> Dimitris
>>>>>>>>>>>>
>>>>>>>>>>>> Yuri G wrote:
>>>>>>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>>>>>>
>>>>>>>>>>>>> <CoreMM.ecore>
>>>>>>>>>>>>> CorePackage : EPackage
>>>>>>>>>>>>> CoreSubPackage : EPackage
>>>>>>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>>>>>>
>>>>>>>>>>>>> <ChildMM.ecore>
>>>>>>>>>>>>> ChildPackage : EPackage
>>>>>>>>>>>>> ChildSubPackage : EPackage
>>>>>>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>>>>>>
>>>>>>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes
>>>>>>>>>>>>> for ClassX and ChildOfY meta-elements.
>>>>>>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>>>>>>> namespaceURI:
>>>>>>>>>>>>>
>>>>>>>>>>>>> context ClassX {...}
>>>>>>>>>>>>>
>>>>>>>>>>>>> Now I'd like to implement a quick-fix in this constraint
>>>>>>>>>>>>> which would create a ChildOfY node in my diagram and add a
>>>>>>>>>>>>> reference to it into the validated ClassX if needed. But
>>>>>>>>>>>>> there's no way I can get to ChildOfY EClass to create its
>>>>>>>>>>>>> instance.
>>>>>>>>>>>>>
>>>>>>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>>>>>>> initially tried to access it from my .evl file. But,
>>>>>>>>>>>>> apparently, I can't access this package, because it has
>>>>>>>>>>>>> another namespaceURI than CorePackage and resides in another
>>>>>>>>>>>>> .ecore file.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I also think about creating an Epsilon wizard instead of
>>>>>>>>>>>>> this quick-fix. But I haven't looked into EWL much, so I'm
>>>>>>>>>>>>> not sure if it's even possible.
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>
>>
>>
Re: Accessing subpackages in EVL [message #567416 is a reply to message #16904] Thu, 30 April 2009 12:05 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

If you only have one model, you can skip the ModelName! part and just
use packagename::classname

Cheers,
Dimitris

Yuri G wrote:
> Hello!
>
> Another simple question about EVL. What is a syntax to access
> subpackage's classes?
> The syntax subPackageOfPackageA::subClass seems not to work in the .evl
> file which is associated with PackageA.
>
> Also I've found out that there's an ! operation in EOL which gives
> access to metamodel's elements like:
>
> ModelName!packageName::className
>
> but it's not clear how to use it in EVL, where do I get the ModelName?
>
Re: Accessing subpackages in EVL [message #567428 is a reply to message #16965] Thu, 30 April 2009 12:40 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Dimitris Kolovos wrote:
> Hi Yuri,
>
> If you only have one model, you can skip the ModelName! part and just
> use packagename::classname

this should read PackageA::subPackageOfPackageA::subClass

>
> Cheers,
> Dimitris
>
> Yuri G wrote:
>> Hello!
>>
>> Another simple question about EVL. What is a syntax to access
>> subpackage's classes?
>> The syntax subPackageOfPackageA::subClass seems not to work in the
>> .evl file which is associated with PackageA.
>>
>> Also I've found out that there's an ! operation in EOL which gives
>> access to metamodel's elements like:
>>
>> ModelName!packageName::className
>>
>> but it's not clear how to use it in EVL, where do I get the ModelName?
>>
Re: Accessing subpackages in EVL [message #567447 is a reply to message #16992] Thu, 30 April 2009 13:05 Go to previous message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Dimitris Kolovos wrote:

> this should read PackageA::subPackageOfPackageA::subClass

It works this way. Thank you very much, Dimitris!

Yet another question: is it possible to access arbitrary metamodel from my
evl constraint?

For example in QVTO there's a 'modeltype' construction which gives access
to any metamodel:

modeltype MINDMAP uses mindmap('http://www.example.org/mindmap');
...
var myTopic := object MINDMAP::Topic {};
Re: Accessing subpackages in EVL [message #567473 is a reply to message #17021] Thu, 30 April 2009 13:39 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

In the current version you only have access to the metamodel specified
in the namespaceURI attribute of the extension. Can I ask what's your
use case for this? We'd certainly be happy to support this in future
versions of Epsilon if there's good motivation.

Cheers,
Dimitris

Yuri G wrote:
> Dimitris Kolovos wrote:
>
>> this should read PackageA::subPackageOfPackageA::subClass
>
> It works this way. Thank you very much, Dimitris!
>
> Yet another question: is it possible to access arbitrary metamodel from
> my evl constraint?
> For example in QVTO there's a 'modeltype' construction which gives
> access to any metamodel:
>
> modeltype MINDMAP uses mindmap('http://www.example.org/mindmap');
> ..
> var myTopic := object MINDMAP::Topic {};
>
>
>
Re: Accessing subpackages in EVL [message #567496 is a reply to message #17050] Thu, 30 April 2009 14:47 Go to previous message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
I see, Dimitris, thanks for reply. Let me illustrate my case.

The metamodel is split into two .ecore files:

<CoreMM.ecore>
CorePackage : EPackage
CoreSubPackage : EPackage
CoreClass : EClass (contains ClassX elements)
ClassX : EClass (contains references to ClassY)
ClassY : EClass (abstract)

<ChildMM.ecore>
ChildPackage : EPackage
ChildSubPackage : EPackage
ChildOfY : EClass -> ClassY

Developed GMF editor for CoreClass can draw diagram nodes for ClassX and
ChildOfY meta-elements.

I've created a .evl constraint binded to CoreSubPackage namespaceURI:

context ClassX {...}

Now I'd like to implement a quick-fix in this constraint which would
create a ChildOfY node in my diagram and add a reference to it into the
validated ClassX if needed. But there's no way I can get to ChildOfY
EClass to create its instance.

ChildPackage has the same name as CorePackage, that's why I initially
tried to access it from my .evl file. But, apparently, I can't access this
package, because it has another namespaceURI than CorePackage and resides
in another .ecore file.

I also think about creating an Epsilon wizard instead of this quick-fix.
But I haven't looked into EWL much, so I'm not sure if it's even possible.
Re: Accessing subpackages in EVL [message #567571 is a reply to message #17079] Thu, 30 April 2009 15:50 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

This makes much sense indeed. I'm working on a patch for this now and
will hopefully release a new interim version later on today.

Cheers,
Dimitris

Yuri G wrote:
> I see, Dimitris, thanks for reply. Let me illustrate my case.
> The metamodel is split into two .ecore files:
>
> <CoreMM.ecore>
> CorePackage : EPackage
> CoreSubPackage : EPackage
> CoreClass : EClass (contains ClassX elements)
> ClassX : EClass (contains references to ClassY)
> ClassY : EClass (abstract)
>
> <ChildMM.ecore>
> ChildPackage : EPackage
> ChildSubPackage : EPackage
> ChildOfY : EClass -> ClassY
>
> Developed GMF editor for CoreClass can draw diagram nodes for ClassX and
> ChildOfY meta-elements.
> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>
> context ClassX {...}
>
> Now I'd like to implement a quick-fix in this constraint which would
> create a ChildOfY node in my diagram and add a reference to it into the
> validated ClassX if needed. But there's no way I can get to ChildOfY
> EClass to create its instance.
>
> ChildPackage has the same name as CorePackage, that's why I initially
> tried to access it from my .evl file. But, apparently, I can't access
> this package, because it has another namespaceURI than CorePackage and
> resides in another .ecore file.
>
> I also think about creating an Epsilon wizard instead of this quick-fix.
> But I haven't looked into EWL much, so I'm not sure if it's even possible.
>
Re: Accessing subpackages in EVL [message #567593 is a reply to message #17165] Thu, 30 April 2009 15:53 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
In the meantime could you please open a new enhancement request about
this in the bugzilla so that we can keep track of this?

Cheers,
Dimitris

Dimitris Kolovos wrote:
> Hi Yuri,
>
> This makes much sense indeed. I'm working on a patch for this now and
> will hopefully release a new interim version later on today.
>
> Cheers,
> Dimitris
>
> Yuri G wrote:
>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>> The metamodel is split into two .ecore files:
>>
>> <CoreMM.ecore>
>> CorePackage : EPackage
>> CoreSubPackage : EPackage
>> CoreClass : EClass (contains ClassX elements)
>> ClassX : EClass (contains references to ClassY)
>> ClassY : EClass (abstract)
>>
>> <ChildMM.ecore>
>> ChildPackage : EPackage
>> ChildSubPackage : EPackage
>> ChildOfY : EClass -> ClassY
>>
>> Developed GMF editor for CoreClass can draw diagram nodes for ClassX
>> and ChildOfY meta-elements.
>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>
>> context ClassX {...}
>>
>> Now I'd like to implement a quick-fix in this constraint which would
>> create a ChildOfY node in my diagram and add a reference to it into
>> the validated ClassX if needed. But there's no way I can get to
>> ChildOfY EClass to create its instance.
>>
>> ChildPackage has the same name as CorePackage, that's why I initially
>> tried to access it from my .evl file. But, apparently, I can't access
>> this package, because it has another namespaceURI than CorePackage and
>> resides in another .ecore file.
>>
>> I also think about creating an Epsilon wizard instead of this
>> quick-fix. But I haven't looked into EWL much, so I'm not sure if it's
>> even possible.
>>
Re: Accessing subpackages in EVL [message #567619 is a reply to message #17165] Thu, 30 April 2009 15:56 Go to previous message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
That's awesome! Looking forward to the patch release.
Re: Accessing subpackages in EVL [message #567636 is a reply to message #17194] Thu, 30 April 2009 16:24 Go to previous message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Sure, done:

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

Dimitris Kolovos wrote:

> In the meantime could you please open a new enhancement request about
> this in the bugzilla so that we can keep track of this?

> Cheers,
> Dimitris

> Dimitris Kolovos wrote:
>> Hi Yuri,
>>
>> This makes much sense indeed. I'm working on a patch for this now and
>> will hopefully release a new interim version later on today.
>>
>> Cheers,
>> Dimitris
>>
>> Yuri G wrote:
>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>> The metamodel is split into two .ecore files:
>>>
>>> <CoreMM.ecore>
>>> CorePackage : EPackage
>>> CoreSubPackage : EPackage
>>> CoreClass : EClass (contains ClassX elements)
>>> ClassX : EClass (contains references to ClassY)
>>> ClassY : EClass (abstract)
>>>
>>> <ChildMM.ecore>
>>> ChildPackage : EPackage
>>> ChildSubPackage : EPackage
>>> ChildOfY : EClass -> ClassY
>>>
>>> Developed GMF editor for CoreClass can draw diagram nodes for ClassX
>>> and ChildOfY meta-elements.
>>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>>
>>> context ClassX {...}
>>>
>>> Now I'd like to implement a quick-fix in this constraint which would
>>> create a ChildOfY node in my diagram and add a reference to it into
>>> the validated ClassX if needed. But there's no way I can get to
>>> ChildOfY EClass to create its instance.
>>>
>>> ChildPackage has the same name as CorePackage, that's why I initially
>>> tried to access it from my .evl file. But, apparently, I can't access
>>> this package, because it has another namespaceURI than CorePackage and
>>> resides in another .ecore file.
>>>
>>> I also think about creating an Epsilon wizard instead of this
>>> quick-fix. But I haven't looked into EWL much, so I'm not sure if it's
>>> even possible.
>>>
Re: Accessing subpackages in EVL [message #567649 is a reply to message #17249] Thu, 30 April 2009 16:55 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Thanks Yuri. I've just uploaded a new interim version
(0.8.5.200904301737) under
http://download.eclipse.org/modeling/gmt/epsilon/interim/ To create a
new ChildOfY you should now add the following line of code before:

_Model.addNamespaceUri('uri-of-ChildPackage');
var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;

(_Model is the implicit name of the currently validated model)

Please let me know if it works for you. If not, I'll give it another go
tomorrow with a clearer mind.

Cheers,
Dimitris

Yuri G wrote:
> Sure, done:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>
> Dimitris Kolovos wrote:
>
>> In the meantime could you please open a new enhancement request about
>> this in the bugzilla so that we can keep track of this?
>
>> Cheers,
>> Dimitris
>
>> Dimitris Kolovos wrote:
>>> Hi Yuri,
>>>
>>> This makes much sense indeed. I'm working on a patch for this now and
>>> will hopefully release a new interim version later on today.
>>>
>>> Cheers,
>>> Dimitris
>>>
>>> Yuri G wrote:
>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>> The metamodel is split into two .ecore files:
>>>>
>>>> <CoreMM.ecore>
>>>> CorePackage : EPackage
>>>> CoreSubPackage : EPackage
>>>> CoreClass : EClass (contains ClassX elements)
>>>> ClassX : EClass (contains references to ClassY)
>>>> ClassY : EClass (abstract)
>>>>
>>>> <ChildMM.ecore>
>>>> ChildPackage : EPackage
>>>> ChildSubPackage : EPackage
>>>> ChildOfY : EClass -> ClassY
>>>>
>>>> Developed GMF editor for CoreClass can draw diagram nodes for ClassX
>>>> and ChildOfY meta-elements.
>>>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>>>
>>>> context ClassX {...}
>>>>
>>>> Now I'd like to implement a quick-fix in this constraint which would
>>>> create a ChildOfY node in my diagram and add a reference to it into
>>>> the validated ClassX if needed. But there's no way I can get to
>>>> ChildOfY EClass to create its instance.
>>>>
>>>> ChildPackage has the same name as CorePackage, that's why I
>>>> initially tried to access it from my .evl file. But, apparently, I
>>>> can't access this package, because it has another namespaceURI than
>>>> CorePackage and resides in another .ecore file.
>>>>
>>>> I also think about creating an Epsilon wizard instead of this
>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure if
>>>> it's even possible.
>>>>
>
>
Re: Accessing subpackages in EVL [message #567708 is a reply to message #17276] Fri, 01 May 2009 07:46 Go to previous message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Hello, Dimitris!

I've just tried the patch, seems not to work with runtime error 'Method
'addNamespaceUri' not found'.

Also I did a search for 'addNamespaceUri' string in the source codes of
the downloaded interim plug-ins and it found nothing.

Dimitris Kolovos wrote:

> Thanks Yuri. I've just uploaded a new interim version
> (0.8.5.200904301737) under
> http://download.eclipse.org/modeling/gmt/epsilon/interim/ To create a
> new ChildOfY you should now add the following line of code before:

> _Model.addNamespaceUri('uri-of-ChildPackage');
> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;

> (_Model is the implicit name of the currently validated model)

> Please let me know if it works for you. If not, I'll give it another go
> tomorrow with a clearer mind.

> Cheers,
> Dimitris

> Yuri G wrote:
>> Sure, done:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>
>> Dimitris Kolovos wrote:
>>
>>> In the meantime could you please open a new enhancement request about
>>> this in the bugzilla so that we can keep track of this?
>>
>>> Cheers,
>>> Dimitris
>>
>>> Dimitris Kolovos wrote:
>>>> Hi Yuri,
>>>>
>>>> This makes much sense indeed. I'm working on a patch for this now and
>>>> will hopefully release a new interim version later on today.
>>>>
>>>> Cheers,
>>>> Dimitris
>>>>
>>>> Yuri G wrote:
>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>> The metamodel is split into two .ecore files:
>>>>>
>>>>> <CoreMM.ecore>
>>>>> CorePackage : EPackage
>>>>> CoreSubPackage : EPackage
>>>>> CoreClass : EClass (contains ClassX elements)
>>>>> ClassX : EClass (contains references to ClassY)
>>>>> ClassY : EClass (abstract)
>>>>>
>>>>> <ChildMM.ecore>
>>>>> ChildPackage : EPackage
>>>>> ChildSubPackage : EPackage
>>>>> ChildOfY : EClass -> ClassY
>>>>>
>>>>> Developed GMF editor for CoreClass can draw diagram nodes for ClassX
>>>>> and ChildOfY meta-elements.
>>>>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>>>>
>>>>> context ClassX {...}
>>>>>
>>>>> Now I'd like to implement a quick-fix in this constraint which would
>>>>> create a ChildOfY node in my diagram and add a reference to it into
>>>>> the validated ClassX if needed. But there's no way I can get to
>>>>> ChildOfY EClass to create its instance.
>>>>>
>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>> initially tried to access it from my .evl file. But, apparently, I
>>>>> can't access this package, because it has another namespaceURI than
>>>>> CorePackage and resides in another .ecore file.
>>>>>
>>>>> I also think about creating an Epsilon wizard instead of this
>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure if
>>>>> it's even possible.
>>>>>
>>
>>
Re: Accessing subpackages in EVL [message #567738 is a reply to message #17353] Fri, 01 May 2009 08:53 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

Sorry about that. The method is actually called addMetamodelUri instead
of addNamespaceUri.

Cheers,
Dimitris

Yuri G wrote:
> Hello, Dimitris!
>
> I've just tried the patch, seems not to work with runtime error 'Method
> 'addNamespaceUri' not found'.
> Also I did a search for 'addNamespaceUri' string in the source codes of
> the downloaded interim plug-ins and it found nothing.
>
> Dimitris Kolovos wrote:
>
>> Thanks Yuri. I've just uploaded a new interim version
>> (0.8.5.200904301737) under
>> http://download.eclipse.org/modeling/gmt/epsilon/interim/ To create a
>> new ChildOfY you should now add the following line of code before:
>
>> _Model.addNamespaceUri('uri-of-ChildPackage');
>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>
>> (_Model is the implicit name of the currently validated model)
>
>> Please let me know if it works for you. If not, I'll give it another
>> go tomorrow with a clearer mind.
>
>> Cheers,
>> Dimitris
>
>> Yuri G wrote:
>>> Sure, done:
>>>
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>
>>> Dimitris Kolovos wrote:
>>>
>>>> In the meantime could you please open a new enhancement request
>>>> about this in the bugzilla so that we can keep track of this?
>>>
>>>> Cheers,
>>>> Dimitris
>>>
>>>> Dimitris Kolovos wrote:
>>>>> Hi Yuri,
>>>>>
>>>>> This makes much sense indeed. I'm working on a patch for this now
>>>>> and will hopefully release a new interim version later on today.
>>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>>
>>>>> Yuri G wrote:
>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>> The metamodel is split into two .ecore files:
>>>>>>
>>>>>> <CoreMM.ecore>
>>>>>> CorePackage : EPackage
>>>>>> CoreSubPackage : EPackage
>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>> ClassY : EClass (abstract)
>>>>>>
>>>>>> <ChildMM.ecore>
>>>>>> ChildPackage : EPackage
>>>>>> ChildSubPackage : EPackage
>>>>>> ChildOfY : EClass -> ClassY
>>>>>>
>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>> ClassX and ChildOfY meta-elements.
>>>>>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>>>>>
>>>>>> context ClassX {...}
>>>>>>
>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>> would create a ChildOfY node in my diagram and add a reference to
>>>>>> it into the validated ClassX if needed. But there's no way I can
>>>>>> get to ChildOfY EClass to create its instance.
>>>>>>
>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>> initially tried to access it from my .evl file. But, apparently, I
>>>>>> can't access this package, because it has another namespaceURI
>>>>>> than CorePackage and resides in another .ecore file.
>>>>>>
>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure if
>>>>>> it's even possible.
>>>>>>
>>>
>>>
>
>
Re: Accessing subpackages in EVL [message #567766 is a reply to message #17374] Fri, 01 May 2009 12:36 Go to previous message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Hi, Dimitris. Thank you for reply!

addMetamodelUri almost works. Now my constraint can see the classes from
the added EPackage. So code like this:

ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints class name

works just fine. Also now I can create instances of ChildOfY in the DO
block of FIX statement of the constraint:

var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
childOfY.println(); -- ok

But I can see changes to the diagram only after I refresh it with pressing
F5 which is not very convenient.

Also writing the same code in some operation throws an exception
"java.lang.IllegalStateException: Cannot modify resource set without a
write transaction". Though if I press F5 after that, the new node ChildOfY
will be shown in the diagram.

Dimitris Kolovos wrote:

> Hi Yuri,

> Sorry about that. The method is actually called addMetamodelUri instead
> of addNamespaceUri.

> Cheers,
> Dimitris

> Yuri G wrote:
>> Hello, Dimitris!
>>
>> I've just tried the patch, seems not to work with runtime error 'Method
>> 'addNamespaceUri' not found'.
>> Also I did a search for 'addNamespaceUri' string in the source codes of
>> the downloaded interim plug-ins and it found nothing.
>>
>> Dimitris Kolovos wrote:
>>
>>> Thanks Yuri. I've just uploaded a new interim version
>>> (0.8.5.200904301737) under
>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/ To create a
>>> new ChildOfY you should now add the following line of code before:
>>
>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>
>>> (_Model is the implicit name of the currently validated model)
>>
>>> Please let me know if it works for you. If not, I'll give it another
>>> go tomorrow with a clearer mind.
>>
>>> Cheers,
>>> Dimitris
>>
>>> Yuri G wrote:
>>>> Sure, done:
>>>>
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>
>>>> Dimitris Kolovos wrote:
>>>>
>>>>> In the meantime could you please open a new enhancement request
>>>>> about this in the bugzilla so that we can keep track of this?
>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>
>>>>> Dimitris Kolovos wrote:
>>>>>> Hi Yuri,
>>>>>>
>>>>>> This makes much sense indeed. I'm working on a patch for this now
>>>>>> and will hopefully release a new interim version later on today.
>>>>>>
>>>>>> Cheers,
>>>>>> Dimitris
>>>>>>
>>>>>> Yuri G wrote:
>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>
>>>>>>> <CoreMM.ecore>
>>>>>>> CorePackage : EPackage
>>>>>>> CoreSubPackage : EPackage
>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>> ClassY : EClass (abstract)
>>>>>>>
>>>>>>> <ChildMM.ecore>
>>>>>>> ChildPackage : EPackage
>>>>>>> ChildSubPackage : EPackage
>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>
>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>>> ClassX and ChildOfY meta-elements.
>>>>>>> I've created a .evl constraint binded to CoreSubPackage namespaceURI:
>>>>>>>
>>>>>>> context ClassX {...}
>>>>>>>
>>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>>> would create a ChildOfY node in my diagram and add a reference to
>>>>>>> it into the validated ClassX if needed. But there's no way I can
>>>>>>> get to ChildOfY EClass to create its instance.
>>>>>>>
>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>> initially tried to access it from my .evl file. But, apparently, I
>>>>>>> can't access this package, because it has another namespaceURI
>>>>>>> than CorePackage and resides in another .ecore file.
>>>>>>>
>>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure if
>>>>>>> it's even possible.
>>>>>>>
>>>>
>>>>
>>
>>
Re: Accessing subpackages in EVL [message #567798 is a reply to message #17842] Fri, 01 May 2009 12:51 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

Looking into the F5 and exception issues now..

Cheers,
Dimitris

Yuri G wrote:
> Hi, Dimitris. Thank you for reply!
>
> addMetamodelUri almost works. Now my constraint can see the classes from
> the added EPackage. So code like this:
>
> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints class name
>
> works just fine. Also now I can create instances of ChildOfY in the DO
> block of FIX statement of the constraint:
>
> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
> childOfY.println(); -- ok
>
> But I can see changes to the diagram only after I refresh it with
> pressing F5 which is not very convenient.
>
> Also writing the same code in some operation throws an exception
> "java.lang.IllegalStateException: Cannot modify resource set without a
> write transaction". Though if I press F5 after that, the new node
> ChildOfY will be shown in the diagram.
>
> Dimitris Kolovos wrote:
>
>> Hi Yuri,
>
>> Sorry about that. The method is actually called addMetamodelUri
>> instead of addNamespaceUri.
>
>> Cheers,
>> Dimitris
>
>> Yuri G wrote:
>>> Hello, Dimitris!
>>>
>>> I've just tried the patch, seems not to work with runtime error
>>> 'Method 'addNamespaceUri' not found'.
>>> Also I did a search for 'addNamespaceUri' string in the source codes
>>> of the downloaded interim plug-ins and it found nothing.
>>>
>>> Dimitris Kolovos wrote:
>>>
>>>> Thanks Yuri. I've just uploaded a new interim version
>>>> (0.8.5.200904301737) under
>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/ To create
>>>> a new ChildOfY you should now add the following line of code before:
>>>
>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>
>>>> (_Model is the implicit name of the currently validated model)
>>>
>>>> Please let me know if it works for you. If not, I'll give it another
>>>> go tomorrow with a clearer mind.
>>>
>>>> Cheers,
>>>> Dimitris
>>>
>>>> Yuri G wrote:
>>>>> Sure, done:
>>>>>
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>
>>>>> Dimitris Kolovos wrote:
>>>>>
>>>>>> In the meantime could you please open a new enhancement request
>>>>>> about this in the bugzilla so that we can keep track of this?
>>>>>
>>>>>> Cheers,
>>>>>> Dimitris
>>>>>
>>>>>> Dimitris Kolovos wrote:
>>>>>>> Hi Yuri,
>>>>>>>
>>>>>>> This makes much sense indeed. I'm working on a patch for this now
>>>>>>> and will hopefully release a new interim version later on today.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Dimitris
>>>>>>>
>>>>>>> Yuri G wrote:
>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>
>>>>>>>> <CoreMM.ecore>
>>>>>>>> CorePackage : EPackage
>>>>>>>> CoreSubPackage : EPackage
>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>
>>>>>>>> <ChildMM.ecore>
>>>>>>>> ChildPackage : EPackage
>>>>>>>> ChildSubPackage : EPackage
>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>
>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>>>> ClassX and ChildOfY meta-elements.
>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>> namespaceURI:
>>>>>>>>
>>>>>>>> context ClassX {...}
>>>>>>>>
>>>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>>>> would create a ChildOfY node in my diagram and add a reference
>>>>>>>> to it into the validated ClassX if needed. But there's no way I
>>>>>>>> can get to ChildOfY EClass to create its instance.
>>>>>>>>
>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>> initially tried to access it from my .evl file. But, apparently,
>>>>>>>> I can't access this package, because it has another namespaceURI
>>>>>>>> than CorePackage and resides in another .ecore file.
>>>>>>>>
>>>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure
>>>>>>>> if it's even possible.
>>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
Re: Accessing subpackages in EVL [message #567829 is a reply to message #17852] Fri, 01 May 2009 13:20 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

Unfortunately, I'm not able to reproduce this with the mindmap editor.
Could you please send me a copy of your plugins (or a minimal example
that reproduces the problem) so that I can test more?

Is this only happening only when you are trying to instantiate classes
from the added metamodel or for all classes?

Cheers,
Dimitris

Dimitris Kolovos wrote:
> Hi Yuri,
>
> Looking into the F5 and exception issues now..
>
> Cheers,
> Dimitris
>
> Yuri G wrote:
>> Hi, Dimitris. Thank you for reply!
>>
>> addMetamodelUri almost works. Now my constraint can see the classes
>> from the added EPackage. So code like this:
>>
>> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints class
>> name
>>
>> works just fine. Also now I can create instances of ChildOfY in the DO
>> block of FIX statement of the constraint:
>>
>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>> childOfY.println(); -- ok
>>
>> But I can see changes to the diagram only after I refresh it with
>> pressing F5 which is not very convenient.
>>
>> Also writing the same code in some operation throws an exception
>> "java.lang.IllegalStateException: Cannot modify resource set without a
>> write transaction". Though if I press F5 after that, the new node
>> ChildOfY will be shown in the diagram.
>>
>> Dimitris Kolovos wrote:
>>
>>> Hi Yuri,
>>
>>> Sorry about that. The method is actually called addMetamodelUri
>>> instead of addNamespaceUri.
>>
>>> Cheers,
>>> Dimitris
>>
>>> Yuri G wrote:
>>>> Hello, Dimitris!
>>>>
>>>> I've just tried the patch, seems not to work with runtime error
>>>> 'Method 'addNamespaceUri' not found'.
>>>> Also I did a search for 'addNamespaceUri' string in the source codes
>>>> of the downloaded interim plug-ins and it found nothing.
>>>>
>>>> Dimitris Kolovos wrote:
>>>>
>>>>> Thanks Yuri. I've just uploaded a new interim version
>>>>> (0.8.5.200904301737) under
>>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/ To
>>>>> create a new ChildOfY you should now add the following line of code
>>>>> before:
>>>>
>>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>
>>>>> (_Model is the implicit name of the currently validated model)
>>>>
>>>>> Please let me know if it works for you. If not, I'll give it
>>>>> another go tomorrow with a clearer mind.
>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>
>>>>> Yuri G wrote:
>>>>>> Sure, done:
>>>>>>
>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>>
>>>>>> Dimitris Kolovos wrote:
>>>>>>
>>>>>>> In the meantime could you please open a new enhancement request
>>>>>>> about this in the bugzilla so that we can keep track of this?
>>>>>>
>>>>>>> Cheers,
>>>>>>> Dimitris
>>>>>>
>>>>>>> Dimitris Kolovos wrote:
>>>>>>>> Hi Yuri,
>>>>>>>>
>>>>>>>> This makes much sense indeed. I'm working on a patch for this
>>>>>>>> now and will hopefully release a new interim version later on
>>>>>>>> today.
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Dimitris
>>>>>>>>
>>>>>>>> Yuri G wrote:
>>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>>
>>>>>>>>> <CoreMM.ecore>
>>>>>>>>> CorePackage : EPackage
>>>>>>>>> CoreSubPackage : EPackage
>>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>>
>>>>>>>>> <ChildMM.ecore>
>>>>>>>>> ChildPackage : EPackage
>>>>>>>>> ChildSubPackage : EPackage
>>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>>
>>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>>>>> ClassX and ChildOfY meta-elements.
>>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>>> namespaceURI:
>>>>>>>>>
>>>>>>>>> context ClassX {...}
>>>>>>>>>
>>>>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>>>>> would create a ChildOfY node in my diagram and add a reference
>>>>>>>>> to it into the validated ClassX if needed. But there's no way I
>>>>>>>>> can get to ChildOfY EClass to create its instance.
>>>>>>>>>
>>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>>> initially tried to access it from my .evl file. But,
>>>>>>>>> apparently, I can't access this package, because it has another
>>>>>>>>> namespaceURI than CorePackage and resides in another .ecore file.
>>>>>>>>>
>>>>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure
>>>>>>>>> if it's even possible.
>>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
Re: Accessing subpackages in EVL [message #567855 is a reply to message #17867] Fri, 01 May 2009 18:31 Go to previous message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Hi Dimitris,

Well, I guess I found out that pressing F5 is needed because I didn't
actually add the created instance of ChildOfY to the validated ClassX. Now
it shows in the diagram immediately. So this issue is solved.

Also if I just create the variable of type ClassX and don't "insert" into
the diagram's domain element it would not be shown either (until I press
F5). Though if I save the diagram (even without refreshing it), this
instance of ClassX would be added to the model file, but as an "outside"
head XMI node like this:

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI ....>
<CoreClass/> // this is diagram node
<ClassX/> // this variable was defined in the quick-fix
</xmi:XMI>

I'm going to test addMetamodelUri on the weekend more and write you back
if the problem with exception persists or anything (I've just tried to
reproduce the exception, unsuccessfully...).

Thank for you very much for your replies and the patch, Dimitris!

Regards, Yuri.

Dimitris Kolovos wrote:

> Hi Yuri,

> Unfortunately, I'm not able to reproduce this with the mindmap editor.
> Could you please send me a copy of your plugins (or a minimal example
> that reproduces the problem) so that I can test more?

> Is this only happening only when you are trying to instantiate classes
> from the added metamodel or for all classes?

> Cheers,
> Dimitris

> Dimitris Kolovos wrote:
>> Hi Yuri,
>>
>> Looking into the F5 and exception issues now..
>>
>> Cheers,
>> Dimitris
>>
>> Yuri G wrote:
>>> Hi, Dimitris. Thank you for reply!
>>>
>>> addMetamodelUri almost works. Now my constraint can see the classes
>>> from the added EPackage. So code like this:
>>>
>>> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints class
>>> name
>>>
>>> works just fine. Also now I can create instances of ChildOfY in the DO
>>> block of FIX statement of the constraint:
>>>
>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>> childOfY.println(); -- ok
>>>
>>> But I can see changes to the diagram only after I refresh it with
>>> pressing F5 which is not very convenient.
>>>
>>> Also writing the same code in some operation throws an exception
>>> "java.lang.IllegalStateException: Cannot modify resource set without a
>>> write transaction". Though if I press F5 after that, the new node
>>> ChildOfY will be shown in the diagram.
>>>
>>> Dimitris Kolovos wrote:
>>>
>>>> Hi Yuri,
>>>
>>>> Sorry about that. The method is actually called addMetamodelUri
>>>> instead of addNamespaceUri.
>>>
>>>> Cheers,
>>>> Dimitris
>>>
>>>> Yuri G wrote:
>>>>> Hello, Dimitris!
>>>>>
>>>>> I've just tried the patch, seems not to work with runtime error
>>>>> 'Method 'addNamespaceUri' not found'.
>>>>> Also I did a search for 'addNamespaceUri' string in the source codes
>>>>> of the downloaded interim plug-ins and it found nothing.
>>>>>
>>>>> Dimitris Kolovos wrote:
>>>>>
>>>>>> Thanks Yuri. I've just uploaded a new interim version
>>>>>> (0.8.5.200904301737) under
>>>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/ To
>>>>>> create a new ChildOfY you should now add the following line of code
>>>>>> before:
>>>>>
>>>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>>
>>>>>> (_Model is the implicit name of the currently validated model)
>>>>>
>>>>>> Please let me know if it works for you. If not, I'll give it
>>>>>> another go tomorrow with a clearer mind.
>>>>>
>>>>>> Cheers,
>>>>>> Dimitris
>>>>>
>>>>>> Yuri G wrote:
>>>>>>> Sure, done:
>>>>>>>
>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>>>
>>>>>>> Dimitris Kolovos wrote:
>>>>>>>
>>>>>>>> In the meantime could you please open a new enhancement request
>>>>>>>> about this in the bugzilla so that we can keep track of this?
>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Dimitris
>>>>>>>
>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>> Hi Yuri,
>>>>>>>>>
>>>>>>>>> This makes much sense indeed. I'm working on a patch for this
>>>>>>>>> now and will hopefully release a new interim version later on
>>>>>>>>> today.
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Dimitris
>>>>>>>>>
>>>>>>>>> Yuri G wrote:
>>>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>>>
>>>>>>>>>> <CoreMM.ecore>
>>>>>>>>>> CorePackage : EPackage
>>>>>>>>>> CoreSubPackage : EPackage
>>>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>>>
>>>>>>>>>> <ChildMM.ecore>
>>>>>>>>>> ChildPackage : EPackage
>>>>>>>>>> ChildSubPackage : EPackage
>>>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>>>
>>>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>>>>>> ClassX and ChildOfY meta-elements.
>>>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>>>> namespaceURI:
>>>>>>>>>>
>>>>>>>>>> context ClassX {...}
>>>>>>>>>>
>>>>>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>>>>>> would create a ChildOfY node in my diagram and add a reference
>>>>>>>>>> to it into the validated ClassX if needed. But there's no way I
>>>>>>>>>> can get to ChildOfY EClass to create its instance.
>>>>>>>>>>
>>>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>>>> initially tried to access it from my .evl file. But,
>>>>>>>>>> apparently, I can't access this package, because it has another
>>>>>>>>>> namespaceURI than CorePackage and resides in another .ecore file.
>>>>>>>>>>
>>>>>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure
>>>>>>>>>> if it's even possible.
>>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
Re: Accessing subpackages in EVL [message #567883 is a reply to message #17881] Sun, 03 May 2009 07:38 Go to previous message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Hello, Dimitris,

I think I've found the sources of the reported errors. They're not caused
by using addMetamodelUri().

1. java.lang.IllegalState exception was caused by instantiating metamodel
element in the operation which is called from the 'check' block. Example
for the Mindmap example:

context Map {
constraint Test {
check : poo()
message : 'test!'
}
}

operation poo() : Boolean {
var t : new Topic; -- exception here
return false;
}

Shall I create a bug-report?

2. About the problem with need to refresh the diagram after quick-fix. It
seems that quick fixes work correctly in most cases (i.e. the user doesn't
have to refresh nor re-initialize the diagram file manually).

Though I've sent you a minimal project which reproduces such behavior. I
have the same case in my own project. There's a diagram link used to
represent a containment feature of class A. Class A contains instances of
class B. If in the EVL quick-fix I try to create an instance of B and add
it to the validated A, it wouldn't be shown on the diagram immediately.
Though the changes would be saved to the model file. Any suggestions?

Regards, Yuri

Yuri G wrote:

> Hi Dimitris,

> Well, I guess I found out that pressing F5 is needed because I didn't
> actually add the created instance of ChildOfY to the validated ClassX. Now
> it shows in the diagram immediately. So this issue is solved.

> Also if I just create the variable of type ClassX and don't "insert" into
> the diagram's domain element it would not be shown either (until I press
> F5). Though if I save the diagram (even without refreshing it), this
> instance of ClassX would be added to the model file, but as an "outside"
> head XMI node like this:

> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI ....>
> <CoreClass/> // this is diagram node
> <ClassX/> // this variable was defined in the quick-fix
> </xmi:XMI>

> I'm going to test addMetamodelUri on the weekend more and write you back
> if the problem with exception persists or anything (I've just tried to
> reproduce the exception, unsuccessfully...).

> Thank for you very much for your replies and the patch, Dimitris!

> Regards, Yuri.

> Dimitris Kolovos wrote:

>> Hi Yuri,

>> Unfortunately, I'm not able to reproduce this with the mindmap editor.
>> Could you please send me a copy of your plugins (or a minimal example
>> that reproduces the problem) so that I can test more?

>> Is this only happening only when you are trying to instantiate classes
>> from the added metamodel or for all classes?

>> Cheers,
>> Dimitris

>> Dimitris Kolovos wrote:
>>> Hi Yuri,
>>>
>>> Looking into the F5 and exception issues now..
>>>
>>> Cheers,
>>> Dimitris
>>>
>>> Yuri G wrote:
>>>> Hi, Dimitris. Thank you for reply!
>>>>
>>>> addMetamodelUri almost works. Now my constraint can see the classes
>>>> from the added EPackage. So code like this:
>>>>
>>>> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints class
>>>> name
>>>>
>>>> works just fine. Also now I can create instances of ChildOfY in the DO
>>>> block of FIX statement of the constraint:
>>>>
>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>> childOfY.println(); -- ok
>>>>
>>>> But I can see changes to the diagram only after I refresh it with
>>>> pressing F5 which is not very convenient.
>>>>
>>>> Also writing the same code in some operation throws an exception
>>>> "java.lang.IllegalStateException: Cannot modify resource set without a
>>>> write transaction". Though if I press F5 after that, the new node
>>>> ChildOfY will be shown in the diagram.
>>>>
>>>> Dimitris Kolovos wrote:
>>>>
>>>>> Hi Yuri,
>>>>
>>>>> Sorry about that. The method is actually called addMetamodelUri
>>>>> instead of addNamespaceUri.
>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>
>>>>> Yuri G wrote:
>>>>>> Hello, Dimitris!
>>>>>>
>>>>>> I've just tried the patch, seems not to work with runtime error
>>>>>> 'Method 'addNamespaceUri' not found'.
>>>>>> Also I did a search for 'addNamespaceUri' string in the source codes
>>>>>> of the downloaded interim plug-ins and it found nothing.
>>>>>>
>>>>>> Dimitris Kolovos wrote:
>>>>>>
>>>>>>> Thanks Yuri. I've just uploaded a new interim version
>>>>>>> (0.8.5.200904301737) under
>>>>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/ To
>>>>>>> create a new ChildOfY you should now add the following line of code
>>>>>>> before:
>>>>>>
>>>>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>>>
>>>>>>> (_Model is the implicit name of the currently validated model)
>>>>>>
>>>>>>> Please let me know if it works for you. If not, I'll give it
>>>>>>> another go tomorrow with a clearer mind.
>>>>>>
>>>>>>> Cheers,
>>>>>>> Dimitris
>>>>>>
>>>>>>> Yuri G wrote:
>>>>>>>> Sure, done:
>>>>>>>>
>>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>>>>
>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>
>>>>>>>>> In the meantime could you please open a new enhancement request
>>>>>>>>> about this in the bugzilla so that we can keep track of this?
>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Dimitris
>>>>>>>>
>>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>>> Hi Yuri,
>>>>>>>>>>
>>>>>>>>>> This makes much sense indeed. I'm working on a patch for this
>>>>>>>>>> now and will hopefully release a new interim version later on
>>>>>>>>>> today.
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>> Dimitris
>>>>>>>>>>
>>>>>>>>>> Yuri G wrote:
>>>>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>>>>
>>>>>>>>>>> <CoreMM.ecore>
>>>>>>>>>>> CorePackage : EPackage
>>>>>>>>>>> CoreSubPackage : EPackage
>>>>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>>>>
>>>>>>>>>>> <ChildMM.ecore>
>>>>>>>>>>> ChildPackage : EPackage
>>>>>>>>>>> ChildSubPackage : EPackage
>>>>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>>>>
>>>>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes for
>>>>>>>>>>> ClassX and ChildOfY meta-elements.
>>>>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>>>>> namespaceURI:
>>>>>>>>>>>
>>>>>>>>>>> context ClassX {...}
>>>>>>>>>>>
>>>>>>>>>>> Now I'd like to implement a quick-fix in this constraint which
>>>>>>>>>>> would create a ChildOfY node in my diagram and add a reference
>>>>>>>>>>> to it into the validated ClassX if needed. But there's no way I
>>>>>>>>>>> can get to ChildOfY EClass to create its instance.
>>>>>>>>>>>
>>>>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>>>>> initially tried to access it from my .evl file. But,
>>>>>>>>>>> apparently, I can't access this package, because it has another
>>>>>>>>>>> namespaceURI than CorePackage and resides in another .ecore file.
>>>>>>>>>>>
>>>>>>>>>>> I also think about creating an Epsilon wizard instead of this
>>>>>>>>>>> quick-fix. But I haven't looked into EWL much, so I'm not sure
>>>>>>>>>>> if it's even possible.
>>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
Re: Accessing subpackages in EVL [message #567912 is a reply to message #17894] Thu, 07 May 2009 16:06 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Yuri,

Apologies for the late response. It's been a very busy week. Please see
comments below:

Yuri G wrote:
> Hello, Dimitris,
>
> I think I've found the sources of the reported errors. They're not
> caused by using addMetamodelUri().
>
> 1. java.lang.IllegalState exception was caused by instantiating
> metamodel element in the operation which is called from the 'check'
> block. Example for the Mindmap example:
>
> context Map {
> constraint Test {
> check : poo()
> message : 'test!'
> }
> }
>
> operation poo() : Boolean {
> var t : new Topic; -- exception here
> return false;
> }
>
> Shall I create a bug-report?

Is there any specific reason why you'd want to create objects in the
check part? By default the check part runs in read-only mode (hence the
exception) but again if you have a good reason I'm happy to change this...

>
> 2. About the problem with need to refresh the diagram after quick-fix.
> It seems that quick fixes work correctly in most cases (i.e. the user
> doesn't have to refresh nor re-initialize the diagram file manually).
>
> Though I've sent you a minimal project which reproduces such behavior. I
> have the same case in my own project. There's a diagram link used to
> represent a containment feature of class A. Class A contains instances
> of class B. If in the EVL quick-fix I try to create an instance of B and
> add it to the validated A, it wouldn't be shown on the diagram
> immediately. Though the changes would be saved to the model file. Any
> suggestions?

I'll check with the example you've sent me and get back to you on this
shortly.

>
> Regards, Yuri
>

Cheers,
Dimitris
> Yuri G wrote:
>
>> Hi Dimitris,
>
>> Well, I guess I found out that pressing F5 is needed because I didn't
>> actually add the created instance of ChildOfY to the validated ClassX.
>> Now it shows in the diagram immediately. So this issue is solved.
>
>> Also if I just create the variable of type ClassX and don't "insert"
>> into the diagram's domain element it would not be shown either (until
>> I press F5). Though if I save the diagram (even without refreshing
>> it), this instance of ClassX would be added to the model file, but as
>> an "outside" head XMI node like this:
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xmi:XMI ....>
>> <CoreClass/> // this is diagram node
>> <ClassX/> // this variable was defined in the quick-fix
>> </xmi:XMI>
>
>> I'm going to test addMetamodelUri on the weekend more and write you
>> back if the problem with exception persists or anything (I've just
>> tried to reproduce the exception, unsuccessfully...).
>
>> Thank for you very much for your replies and the patch, Dimitris!
>
>> Regards, Yuri.
>
>> Dimitris Kolovos wrote:
>
>>> Hi Yuri,
>
>>> Unfortunately, I'm not able to reproduce this with the mindmap
>>> editor. Could you please send me a copy of your plugins (or a minimal
>>> example that reproduces the problem) so that I can test more?
>
>>> Is this only happening only when you are trying to instantiate
>>> classes from the added metamodel or for all classes?
>
>>> Cheers,
>>> Dimitris
>
>>> Dimitris Kolovos wrote:
>>>> Hi Yuri,
>>>>
>>>> Looking into the F5 and exception issues now..
>>>>
>>>> Cheers,
>>>> Dimitris
>>>>
>>>> Yuri G wrote:
>>>>> Hi, Dimitris. Thank you for reply!
>>>>>
>>>>> addMetamodelUri almost works. Now my constraint can see the classes
>>>>> from the added EPackage. So code like this:
>>>>>
>>>>> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints
>>>>> class name
>>>>>
>>>>> works just fine. Also now I can create instances of ChildOfY in the
>>>>> DO block of FIX statement of the constraint:
>>>>>
>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>> childOfY.println(); -- ok
>>>>>
>>>>> But I can see changes to the diagram only after I refresh it with
>>>>> pressing F5 which is not very convenient.
>>>>>
>>>>> Also writing the same code in some operation throws an exception
>>>>> "java.lang.IllegalStateException: Cannot modify resource set
>>>>> without a write transaction". Though if I press F5 after that, the
>>>>> new node ChildOfY will be shown in the diagram.
>>>>>
>>>>> Dimitris Kolovos wrote:
>>>>>
>>>>>> Hi Yuri,
>>>>>
>>>>>> Sorry about that. The method is actually called addMetamodelUri
>>>>>> instead of addNamespaceUri.
>>>>>
>>>>>> Cheers,
>>>>>> Dimitris
>>>>>
>>>>>> Yuri G wrote:
>>>>>>> Hello, Dimitris!
>>>>>>>
>>>>>>> I've just tried the patch, seems not to work with runtime error
>>>>>>> 'Method 'addNamespaceUri' not found'.
>>>>>>> Also I did a search for 'addNamespaceUri' string in the source
>>>>>>> codes of the downloaded interim plug-ins and it found nothing.
>>>>>>>
>>>>>>> Dimitris Kolovos wrote:
>>>>>>>
>>>>>>>> Thanks Yuri. I've just uploaded a new interim version
>>>>>>>> (0.8.5.200904301737) under
>>>>>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/ To
>>>>>>>> create a new ChildOfY you should now add the following line of
>>>>>>>> code before:
>>>>>>>
>>>>>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>>>>
>>>>>>>> (_Model is the implicit name of the currently validated model)
>>>>>>>
>>>>>>>> Please let me know if it works for you. If not, I'll give it
>>>>>>>> another go tomorrow with a clearer mind.
>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Dimitris
>>>>>>>
>>>>>>>> Yuri G wrote:
>>>>>>>>> Sure, done:
>>>>>>>>>
>>>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>>>>>
>>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>>
>>>>>>>>>> In the meantime could you please open a new enhancement
>>>>>>>>>> request about this in the bugzilla so that we can keep track
>>>>>>>>>> of this?
>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>> Dimitris
>>>>>>>>>
>>>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>>>> Hi Yuri,
>>>>>>>>>>>
>>>>>>>>>>> This makes much sense indeed. I'm working on a patch for this
>>>>>>>>>>> now and will hopefully release a new interim version later on
>>>>>>>>>>> today.
>>>>>>>>>>>
>>>>>>>>>>> Cheers,
>>>>>>>>>>> Dimitris
>>>>>>>>>>>
>>>>>>>>>>> Yuri G wrote:
>>>>>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>>>>>
>>>>>>>>>>>> <CoreMM.ecore>
>>>>>>>>>>>> CorePackage : EPackage
>>>>>>>>>>>> CoreSubPackage : EPackage
>>>>>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>>>>>
>>>>>>>>>>>> <ChildMM.ecore>
>>>>>>>>>>>> ChildPackage : EPackage
>>>>>>>>>>>> ChildSubPackage : EPackage
>>>>>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>>>>>
>>>>>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes
>>>>>>>>>>>> for ClassX and ChildOfY meta-elements.
>>>>>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>>>>>> namespaceURI:
>>>>>>>>>>>>
>>>>>>>>>>>> context ClassX {...}
>>>>>>>>>>>>
>>>>>>>>>>>> Now I'd like to implement a quick-fix in this constraint
>>>>>>>>>>>> which would create a ChildOfY node in my diagram and add a
>>>>>>>>>>>> reference to it into the validated ClassX if needed. But
>>>>>>>>>>>> there's no way I can get to ChildOfY EClass to create its
>>>>>>>>>>>> instance.
>>>>>>>>>>>>
>>>>>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>>>>>> initially tried to access it from my .evl file. But,
>>>>>>>>>>>> apparently, I can't access this package, because it has
>>>>>>>>>>>> another namespaceURI than CorePackage and resides in another
>>>>>>>>>>>> .ecore file.
>>>>>>>>>>>>
>>>>>>>>>>>> I also think about creating an Epsilon wizard instead of
>>>>>>>>>>>> this quick-fix. But I haven't looked into EWL much, so I'm
>>>>>>>>>>>> not sure if it's even possible.
>>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>
>
>
Re: Accessing subpackages in EVL [message #567941 is a reply to message #17908] Thu, 07 May 2009 16:32 Go to previous message
Yuri G is currently offline Yuri GFriend
Messages: 32
Registered: July 2009
Member
Dimitris Kolovos wrote:

> Hi Yuri,

> Apologies for the late response. It's been a very busy week.

Sure, no problem.

> Is there any specific reason why you'd want to create objects in the
> check part? By default the check part runs in read-only mode (hence the
> exception) but again if you have a good reason I'm happy to change this...

I see. Initially I instantiated an object in check part by accident. I
don't really need such functionality in my project at the moment. Though I
don't see much reason against such functionality except accidental
modification of the validated node (to prevent errors similar to writing
if(a=b) instead of if(a==b) in C). This feature can be even used to
automatically perform quick-fixes from the check block without need for
user to go to the context menu (for example if the mistake is
simple/obvious and doesn't need user's prompt). Or there can be some
Checker object instantiated for the validation of the selected node. Or it
could be a MetricCalculator class created during validation of a Class
node in UML diagram. Just some ideas off the top of my head.

> I'll check with the example you've sent me and get back to you on this
> shortly.

Thank you very much, looking forward to this.


>> Yuri G wrote:
>>
>>> Hi Dimitris,
>>
>>> Well, I guess I found out that pressing F5 is needed because I didn't
>>> actually add the created instance of ChildOfY to the validated ClassX.
>>> Now it shows in the diagram immediately. So this issue is solved.
>>
>>> Also if I just create the variable of type ClassX and don't "insert"
>>> into the diagram's domain element it would not be shown either (until
>>> I press F5). Though if I save the diagram (even without refreshing
>>> it), this instance of ClassX would be added to the model file, but as
>>> an "outside" head XMI node like this:
>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xmi:XMI ....>
>>> <CoreClass/> // this is diagram node
>>> <ClassX/> // this variable was defined in the quick-fix
>>> </xmi:XMI>
>>
>>> I'm going to test addMetamodelUri on the weekend more and write you
>>> back if the problem with exception persists or anything (I've just
>>> tried to reproduce the exception, unsuccessfully...).
>>
>>> Thank for you very much for your replies and the patch, Dimitris!
>>
>>> Regards, Yuri.
>>
>>> Dimitris Kolovos wrote:
>>
>>>> Hi Yuri,
>>
>>>> Unfortunately, I'm not able to reproduce this with the mindmap
>>>> editor. Could you please send me a copy of your plugins (or a minimal
>>>> example that reproduces the problem) so that I can test more?
>>
>>>> Is this only happening only when you are trying to instantiate
>>>> classes from the added metamodel or for all classes?
>>
>>>> Cheers,
>>>> Dimitris
>>
>>>> Dimitris Kolovos wrote:
>>>>> Hi Yuri,
>>>>>
>>>>> Looking into the F5 and exception issues now..
>>>>>
>>>>> Cheers,
>>>>> Dimitris
>>>>>
>>>>> Yuri G wrote:
>>>>>> Hi, Dimitris. Thank you for reply!
>>>>>>
>>>>>> addMetamodelUri almost works. Now my constraint can see the classes
>>>>>> from the added EPackage. So code like this:
>>>>>>
>>>>>> ChildPackage::ChildSubPackage::ChildOfY.name.println() -- prints
>>>>>> class name
>>>>>>
>>>>>> works just fine. Also now I can create instances of ChildOfY in the
>>>>>> DO block of FIX statement of the constraint:
>>>>>>
>>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>>> childOfY.println(); -- ok
>>>>>>
>>>>>> But I can see changes to the diagram only after I refresh it with
>>>>>> pressing F5 which is not very convenient.
>>>>>>
>>>>>> Also writing the same code in some operation throws an exception
>>>>>> "java.lang.IllegalStateException: Cannot modify resource set
>>>>>> without a write transaction". Though if I press F5 after that, the
>>>>>> new node ChildOfY will be shown in the diagram.
>>>>>>
>>>>>> Dimitris Kolovos wrote:
>>>>>>
>>>>>>> Hi Yuri,
>>>>>>
>>>>>>> Sorry about that. The method is actually called addMetamodelUri
>>>>>>> instead of addNamespaceUri.
>>>>>>
>>>>>>> Cheers,
>>>>>>> Dimitris
>>>>>>
>>>>>>> Yuri G wrote:
>>>>>>>> Hello, Dimitris!
>>>>>>>>
>>>>>>>> I've just tried the patch, seems not to work with runtime error
>>>>>>>> 'Method 'addNamespaceUri' not found'.
>>>>>>>> Also I did a search for 'addNamespaceUri' string in the source
>>>>>>>> codes of the downloaded interim plug-ins and it found nothing.
>>>>>>>>
>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>
>>>>>>>>> Thanks Yuri. I've just uploaded a new interim version
>>>>>>>>> (0.8.5.200904301737) under
>>>>>>>>> http://download.eclipse.org/modeling/gmt/epsilon/interim/ To
>>>>>>>>> create a new ChildOfY you should now add the following line of
>>>>>>>>> code before:
>>>>>>>>
>>>>>>>>> _Model.addNamespaceUri('uri-of-ChildPackage');
>>>>>>>>> var childOfY := new ChildPackage::ChildSubPackage::ChildOfY;
>>>>>>>>
>>>>>>>>> (_Model is the implicit name of the currently validated model)
>>>>>>>>
>>>>>>>>> Please let me know if it works for you. If not, I'll give it
>>>>>>>>> another go tomorrow with a clearer mind.
>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Dimitris
>>>>>>>>
>>>>>>>>> Yuri G wrote:
>>>>>>>>>> Sure, done:
>>>>>>>>>>
>>>>>>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=274544
>>>>>>>>>>
>>>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>>>
>>>>>>>>>>> In the meantime could you please open a new enhancement
>>>>>>>>>>> request about this in the bugzilla so that we can keep track
>>>>>>>>>>> of this?
>>>>>>>>>>
>>>>>>>>>>> Cheers,
>>>>>>>>>>> Dimitris
>>>>>>>>>>
>>>>>>>>>>> Dimitris Kolovos wrote:
>>>>>>>>>>>> Hi Yuri,
>>>>>>>>>>>>
>>>>>>>>>>>> This makes much sense indeed. I'm working on a patch for this
>>>>>>>>>>>> now and will hopefully release a new interim version later on
>>>>>>>>>>>> today.
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers,
>>>>>>>>>>>> Dimitris
>>>>>>>>>>>>
>>>>>>>>>>>> Yuri G wrote:
>>>>>>>>>>>>> I see, Dimitris, thanks for reply. Let me illustrate my case.
>>>>>>>>>>>>> The metamodel is split into two .ecore files:
>>>>>>>>>>>>>
>>>>>>>>>>>>> <CoreMM.ecore>
>>>>>>>>>>>>> CorePackage : EPackage
>>>>>>>>>>>>> CoreSubPackage : EPackage
>>>>>>>>>>>>> CoreClass : EClass (contains ClassX elements)
>>>>>>>>>>>>> ClassX : EClass (contains references to ClassY)
>>>>>>>>>>>>> ClassY : EClass (abstract)
>>>>>>>>>>>>>
>>>>>>>>>>>>> <ChildMM.ecore>
>>>>>>>>>>>>> ChildPackage : EPackage
>>>>>>>>>>>>> ChildSubPackage : EPackage
>>>>>>>>>>>>> ChildOfY : EClass -> ClassY
>>>>>>>>>>>>>
>>>>>>>>>>>>> Developed GMF editor for CoreClass can draw diagram nodes
>>>>>>>>>>>>> for ClassX and ChildOfY meta-elements.
>>>>>>>>>>>>> I've created a .evl constraint binded to CoreSubPackage
>>>>>>>>>>>>> namespaceURI:
>>>>>>>>>>>>>
>>>>>>>>>>>>> context ClassX {...}
>>>>>>>>>>>>>
>>>>>>>>>>>>> Now I'd like to implement a quick-fix in this constraint
>>>>>>>>>>>>> which would create a ChildOfY node in my diagram and add a
>>>>>>>>>>>>> reference to it into the validated ClassX if needed. But
>>>>>>>>>>>>> there's no way I can get to ChildOfY EClass to create its
>>>>>>>>>>>>> instance.
>>>>>>>>>>>>>
>>>>>>>>>>>>> ChildPackage has the same name as CorePackage, that's why I
>>>>>>>>>>>>> initially tried to access it from my .evl file. But,
>>>>>>>>>>>>> apparently, I can't access this package, because it has
>>>>>>>>>>>>> another namespaceURI than CorePackage and resides in another
>>>>>>>>>>>>> .ecore file.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I also think about creating an Epsilon wizard instead of
>>>>>>>>>>>>> this quick-fix. But I haven't looked into EWL much, so I'm
>>>>>>>>>>>>> not sure if it's even possible.
>>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>
>>
>>
Previous Topic:epsilon 0.8.5 generation problem
Next Topic:TODO
Goto Forum:
  


Current Time: Mon Sep 23 06:27:33 GMT 2024

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

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

Back to the top