Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Reading XMI error?
Reading XMI error? [message #885561] Wed, 13 June 2012 08:53 Go to next message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
Hi,

A part of ecore file: [HeadModule is extended from Module]

<eClassifiers xsi:type="ecore:EClass" name="Module">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType .../emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="deviceID" eType="ecore:EDataType .../emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="partNumber" eType="ecore:EDataType ..../emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="width" eType="ecore:EDataType .../emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="baseModule" eType="ecore:EDataType .../emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="slotWidth" eType="ecore:EDataType .../emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="s7ModuleReference" eType="ecore:EDataType ..../emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isSelectedWithinStep7"
eType="ecore:EDataType .../emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="config" eType="ecore:EDataType .../emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="HeadModule" eSuperTypes="#//Module">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="hType" eType="ecore:EDataType .../emf/2002/Ecore#//EString"/>
</eClassifiers>


reading xmi input ->java code:

Resource resource = resourceSet.getResource(URI.createFileURI("/Temp/aaa.xmi"),true);
Project root = (Project) model.ModelFactory.eINSTANCE.createProject();
root=(Project)resource.getContents().get(0);


Error->

Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'model.impl.ModuleImpl@12b24bc (name: PSSuniversal2222, deviceID: 0x00000229, partNumber: null, width: null, baseModule: null, slotWidth: null, s7ModuleReference: {2C9A8CF2-2D1B-4F62-A084-1630B9C09817}{001417C4-0000002B-001417C3-0000002A-00112001-00000107}{SD_example1}, isSelectedWithinStep7: false, config: null)' is not legal. (file:///Temp/tpfOut.xmi, 18, 239)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)


Could someone give me a hit to solve this issue?

Thanks in advance.
K
Re: Reading XMI error? [message #885611 is a reply to message #885561] Wed, 13 June 2012 10:19 Go to previous messageGo to next message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
Hi,

I found the error. The error is because of "xsi:type="Module"" in my out.xmi file.

<Device>
<Module name="ccc" isSelected="false"/>
<Module name="aaa" isSelected="false"/>
<HeadModule xsi:type="Module" name="" isSelected="false"/>
</Device>

i get this out.xmi from m2m transformation using ATL. Ayone has a clue, how to get out.xmi without "xsi:type="Module"".

Thanks.
Re: Reading XMI error? [message #885630 is a reply to message #885611] Wed, 13 June 2012 10:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6437
Registered: July 2009
Senior Member
Hi

ATL is a largely declarative language, so one of your rules has been
applied more universally than you expected.

Perhaps you want a guard. Perhaps you want an override.

Regards

Ed Willink

On 13/06/2012 11:19, Kosala Yapa wrote:
> Hi,
>
> I found the error. The error is because of "xsi:type="Module"" in my
> out.xmi file.
>
> <Device>
> <Module name="ccc" isSelected="false"/> <Module name="aaa"
> isSelected="false"/>
> <HeadModule xsi:type="Module" name="" isSelected="false"/>
> </Device>
>
> i get this out.xmi from m2m transformation using ATL. Ayone has a
> clue, how to get out.xmi without "xsi:type="Module"".
>
> Thanks.
Re: Reading XMI error? [message #885654 is a reply to message #885630] Wed, 13 June 2012 12:02 Go to previous messageGo to next message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
Here is my main ATL code.

rule rule_getDevice{
from
a: source!DeviceItem
to
p:target!Device(
name <- a.Name,
s7DeviceReference<-a.DeviceReference,

HeadModule<-a.ModuleList.ModuleItem->select(mi|mi.getSlotValue()='0')->collect(e|thisModule.rule_getHeadModule(e)),

Module<-a.ModuleList.ModuleItem->select(mi|mi.getSlotValue()>'0')->sortedBy(mi|mi.getSlotValue().toInteger())->collect(e|thisModule.rule_getModule(e))

)

}

rule_getModule, and rule_getHeadModule are two lazy rules.
Re: Reading XMI error? [message #885662 is a reply to message #885654] Wed, 13 June 2012 12:09 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6437
Registered: July 2009
Senior Member
Hi
> rule_getModule, and rule_getHeadModule are two lazy rules.
>
which means nothing to me other than giving more opportunity for user
misunderstanding.

I observed what is probably happening; it's for you to debug it.

Intuitively I would expect rule_getModule to be executed for derived
Modules, since rule_getHeadModule is not obviously an occluding override.

Regards

Ed Willink
Re: Reading XMI error? [message #886089 is a reply to message #885662] Thu, 14 June 2012 08:16 Go to previous message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
Many thanks Edward. I got it working !

Kosala
Previous Topic:[NET4J] SSL acceptor support
Next Topic:[CDO] FileNotFoundException when using object.eGet()
Goto Forum:
  


Current Time: Mon Aug 19 05:43:36 GMT 2019

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

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

Back to the top