Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Get IllegalValueException when opening model with Ecore Model Editor (Errors when trying to open instance of a metamodel.)
Get IllegalValueException when opening model with Ecore Model Editor [message #1809305] Fri, 12 July 2019 21:40 Go to next message
Daniel San Martín is currently offline Daniel San MartínFriend
Messages: 45
Registered: October 2012
Member
Hello,

I created a metamodel which uses metadata from other metamodel (KDM metamodel). I can generate the model and an instance of it.

In order to generate the instance of my metamodel, I use an instance of the other metamodel (the KDM) for filling some fields on my instance. At last it creates the xmi representation.

I attached the final xmi. When I tried to open it with ECORE editor it raises several errors:

For instance one of them is:

IllegalValueException: Value 'org.eclipse.gmt.modisco.omg.kdm.code.impl.StorableUnitImpl@423b3ef5 (eProxyURI: /0/@model.0/@codeElement.3/@codeElement.2/@codeElement.2/@codeElement.1/@codeElement.0/@codeElement.0)' is not legal. (platform:/resource/TestModisco/Model/Input_AR.xmi, 5, 154) 


In the same way when I tried to make some model transformations with ATL, same errors appear.

What could be wrong with the metamodel and the instance?

Regards,

Daniel


  • Attachment: Input_AR.xmi
    (Size: 4.95KB, Downloaded 77 times)
Re: Get IllegalValueException when opening model with Ecore Model Editor [message #1809325 is a reply to message #1809305] Sat, 13 July 2019 06:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
You'll be better off asking on a forum related specifically to the technologies you are using. Without detailed information about the metamodel involved to try to reproduce the problem, there's not much I can say other than that this type of problem is mostly an issue of attempting to set a reference where the resolved object is not properly of the correct type so cannot be set into that reference. E.g., in Ecore itself, if a proxy that must reference an EClassifier instead resolves to an EPackage, then the deserializer will throw exactly this type of exception. But note that the model still loads the rest of the data, the illegal stuff will just be missing...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Get IllegalValueException when opening model with Ecore Model Editor [message #1809327 is a reply to message #1809325] Sat, 13 July 2019 07:45 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

With so little to go on one can only guess.

My first guess is that because ATL 3.x did not publish its metamodels in a stable place and ATL 4.x moved them to the standard stable model folder, you may have old models that need reloading and resaving. Perhaps you have a mismatch of tool versions.

Regards

Ed Willink
Re: Get IllegalValueException when opening model with Ecore Model Editor [message #1809340 is a reply to message #1809327] Sat, 13 July 2019 14:40 Go to previous messageGo to next message
Daniel San Martín is currently offline Daniel San MartínFriend
Messages: 45
Registered: October 2012
Member
Hello Ed,


I attached the KDM.ecore and my ,metamodel rMSAS and a instance of a KDM metamodel (generated by modisco). The idea is that my metamodel can represent architectural refactorings.

So my metamodel represents architectural and code operations for refactorings over KDM entities . To create the metamodel I used eclipse 2018-12.

Specifically, My metamodel need to use entities that represent classes, methods, and variables. (ClassUnit, MethodUnit and StorableUnit) from code package of KDM and architectural entities from structure package of KDM such as Component and Subsystem.

Architectural operations must move, create or delete these entities.

Hope this help.

Regards,


Re: Get IllegalValueException when opening model with Ecore Model Editor [message #1809747 is a reply to message #1809340] Mon, 22 July 2019 12:11 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Sorry for the slow response; away at a conference and then catching up.

I do not have Modisco installed on my machine so your UNDERSEA_Controller_KDM.xmi totally fails to load.

Once I add the missing schemaLocation directives to use local files:...

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:action="http://www.eclipse.org/MoDisco/kdm/action"
  xmlns:code="http://www.eclipse.org/MoDisco/kdm/code"
  xmlns:kdm="http://www.eclipse.org/MoDisco/kdm/kdm"
  xmlns:source="http://www.eclipse.org/MoDisco/kdm/source"
  xmlns:structure="http://www.eclipse.org/MoDisco/kdm/structure"
  xsi:schemaLocation="http://www.eclipse.org/MoDisco/kdm/action kdm.ecore#//action http://www.eclipse.org/MoDisco/kdm/code kdm.ecore#//code http://www.eclipse.org/MoDisco/kdm/kdm kdm.ecore#//kdm http://www.eclipse.org/MoDisco/kdm/source kdm.ecore#//source http://www.eclipse.org/MoDisco/kdm/structure kdm.ecore#//structure">
  <kdm:Segment>
   .......


Your file loads but shows some validation errors:

Description Resource Path Location Type
The required feature 'type' of 'Storable Unit MAX_VALUE' must be set UNDERSEA_Controller_KDM.xmi /USER_San_Martin/model Unknown EMF Problem
The required feature 'type' of 'Storable Unit out' must be set UNDERSEA_Controller_KDM.xmi /USER_San_Martin/model Unknown EMF Problem
The required feature 'type' of 'Storable Unit separator' must be set UNDERSEA_Controller_KDM.xmi /USER_San_Martin/model Unknown EMF Problem

which is probably another problem. There is not point expecting some tool to load an EMF-based model if the EMF editpr cannot.

When I go back to Input_AR.xmi and fix its schemaLocation there are more problems due to unresolved proxies.

<abstraction xsi:type="structure:Component" href="UNDERSEA_Controller_KDM.xmi#/0/@model.3/@structureElement.0/@structureElement.0"/>

accesses a structureElement of a structureElement but the target XML is:

<model xsi:type="structure:StructureModel" name="ArchitecturalView UNDERSEA">
<structureElement xsi:type="structure:Component" name="Knowledge_1" implementation="/0/@model.0/@codeElement.1/@codeElement.9"/>
<structureElement xsi:type="structure:Component" name="Executor_1" implementation="/0/@model.0/@codeElement.3/@codeElement.2"/>
<structureElement xsi:type="structure:Component" name="Monitor_1" implementation="/0/@model.0/@codeElement.3/@codeElement.4"/>
<structureElement xsi:type="structure:Component" name="Reference Input_1" implementation="/0/@model.0/@codeElement.3/@codeElement.2/@codeElement.1/@codeElement.1/@codeElement.5/@codeElement.0"/>
<structureElement xsi:type="structure:Component" name="Reference Input_2" implementation="/0/@model.0/@codeElement.3/@codeElement.2/@codeElement.1/@codeElement.1/@codeElement.6/@codeElement.0"/>
<structureElement xsi:type="structure:Component" name="Reference Input_3" implementation="/0/@model.0/@codeElement.3/@codeElement.2/@codeElement.1/@codeElement.1/@codeElement.7/@codeElement.0"/>
</model>

so @model.3/@structureElement.0 is ok but @model.3/@structureElement.0/@structureElement.0 is not.

Looking at the metamodel, AbstractStructureElement uses the composite pattern so a hierarchy of structureElement is possible and there seem to be no volatiles/transients involved, so they should be saved.

I can therefore only conclude that your attachments do not represent a coherent suite of files for me to look at. Perhaps they are not suitable for you either hence your problem. Make sure what you read is the SAME file as what you wrote; no directory typos, no writing multiple times, ...

(It is much easier to provide a zipped repro project so that ALL files are supplied at the SAME time.)

Regards

Ed Willink
Re: Get IllegalValueException when opening model with Ecore Model Editor [message #1809755 is a reply to message #1809747] Mon, 22 July 2019 16:05 Go to previous messageGo to next message
Daniel San Martín is currently offline Daniel San MartínFriend
Messages: 45
Registered: October 2012
Member
The problem was that I generated my metamodel along with the KDM metamodel. As in my eclipse environment I already had installed modisco which comes with the KDM.ecore with their corresponding packages and classes, at the time of creating my instances the types of kdm modisco did not match with mine.

The solution was generate my metamodel and use the modisco kdm.ecore as a reference. Now I am able to generate an instance programmatically. The only problem I am facing is that when I create the editors from the .genmodel, they are created with errors so I cannot create an instance manually.

Regards,
Re: Get IllegalValueException when opening model with Ecore Model Editor [message #1809757 is a reply to message #1809755] Mon, 22 July 2019 16:20 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I am not clear what you are trying to say or what you did originally or did now and since you provide no repro I cannot investigate to see whether there is a bug to fix.

Regards

Ed Willink
Previous Topic:[CDO] How to manually create DDL for schema updates?
Next Topic:EMF eCore .diagram files are not saved in EMF Compare API
Goto Forum:
  


Current Time: Tue Apr 23 06:18:01 GMT 2024

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

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

Back to the top