Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Texo] Issue with FeatureId's
[Texo] Issue with FeatureId's [message #1052507] Tue, 30 April 2013 07:09 Go to next message
techteam is currently offline techteam
Messages: 54
Registered: September 2010
Member
Hi Martin,

first, thanks for the great tool.

but at the moment I have a problem with the the conversion from pojo's
to EMF model objects.

All my classes extends one abstract object and also implements one or
more defined interfaces.
The generation and my object looks good, but on converting the object, i
got message based on wrong feature id's.


Thats my simple test code and I attach my model into this message.

LibraryModelPackage.initialize();

ResourceSet rs = new ResourceSetImpl();
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
new XMIResourceFactoryImpl());
URI fileUri = URI.createFileURI("D:/Library.xmi");
Resource resource = rs.createResource(fileUri);

Library l = new Library();
l.setName("Library");

List<Object> objects = new ArrayList<Object>();
objects.add(l);
Writer w = new Writer();
w.setFirstName("FirstName");
w.setLastName("LastName");
l.addToWriters(w);

Publisher p = new Publisher();
p.setCompany("Company");
l.addToPublishers(p);

Book b = new Book();
b.setTitle("Book");
l.addToBooks(b);

ModelEMFConverter m2eConverter= new ModelEMFConverter();
List<EObject> eObjects = m2eConverter.convert(objects);


If I do run these code I've got:
Exception in thread "main" java.lang.IllegalArgumentException:
EStructuralFeature: org.eclipse.emf.ecore.impl.EAttributeImpl@46f93
(name: id) (ordered: true, unique: true, lowerBound: 0, upperBound: 1)
(changeable: true, volatile: false, transient: false,
defaultValueLiteral: null, unsettable: false, derived: false) (iD:
false) not found in EClass org.eclipse.emf.ecore.impl.EClassImpl@1dbc144
(name: Writer) (instanceClassName: null) (abstract: false, interface: false)
at
org.eclipse.emf.texo.model.AbstractModelObject.eGet(AbstractModelObject.java:59)
at
library.LibraryModelFactory$CommonLibraryObjectModelObject.eGet(LibraryModelFactory.java:358)
at
library.LibraryModelFactory$WriterModelObject.eGet(LibraryModelFactory.java:447)
at
org.eclipse.emf.texo.converter.ModelEMFConverter.convertSingleEAttribute(ModelEMFConverter.java:407)
at
org.eclipse.emf.texo.converter.ModelEMFConverter.convertContent(ModelEMFConverter.java:183)
at
org.eclipse.emf.texo.converter.ModelEMFConverter.convert(ModelEMFConverter.java:104)
at tests.library.Test.main(Test.java:55)

It seems that the the attribute "id" has diffrent feature id's and so it
was not found on conversion.

Is it a bug or a desing error??

Greetings
Heiko
Re: [Texo] Issue with FeatureId's [message #1052900 is a reply to message #1052507] Wed, 01 May 2013 07:18 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5332
Registered: July 2009
Senior Member
Hi Heiko,
I need to test myself, I hope to do that within a day. One question, did you also generate EMF code from this same
model? You debugged and indeed the featureid of the id efeature is not inline with what is expected? Or is the id
efeature not present in the eclass even?

gr. Martin

On 04/30/2013 09:09 AM, Heiko wrote:
> Hi Martin,
>
> first, thanks for the great tool.
>
> but at the moment I have a problem with the the conversion from pojo's to EMF model objects.
>
> All my classes extends one abstract object and also implements one or more defined interfaces.
> The generation and my object looks good, but on converting the object, i got message based on wrong feature id's.
>
>
> Thats my simple test code and I attach my model into this message.
>
> LibraryModelPackage.initialize();
>
> ResourceSet rs = new ResourceSetImpl();
> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new
> XMIResourceFactoryImpl());
> URI fileUri = URI.createFileURI("D:/Library.xmi");
> Resource resource = rs.createResource(fileUri);
>
> Library l = new Library();
> l.setName("Library");
>
> List<Object> objects = new ArrayList<Object>();
> objects.add(l);
> Writer w = new Writer();
> w.setFirstName("FirstName");
> w.setLastName("LastName");
> l.addToWriters(w);
>
> Publisher p = new Publisher();
> p.setCompany("Company");
> l.addToPublishers(p);
>
> Book b = new Book();
> b.setTitle("Book");
> l.addToBooks(b);
>
> ModelEMFConverter m2eConverter= new ModelEMFConverter();
> List<EObject> eObjects = m2eConverter.convert(objects);
>
>
> If I do run these code I've got:
> Exception in thread "main" java.lang.IllegalArgumentException: EStructuralFeature:
> org.eclipse.emf.ecore.impl.EAttributeImpl@46f93 (name: id) (ordered: true, unique: true, lowerBound: 0, upperBound: 1)
> (changeable: true, volatile: false, transient: false, defaultValueLiteral: null, unsettable: false, derived: false) (iD:
> false) not found in EClass org.eclipse.emf.ecore.impl.EClassImpl@1dbc144 (name: Writer) (instanceClassName: null)
> (abstract: false, interface: false)
> at org.eclipse.emf.texo.model.AbstractModelObject.eGet(AbstractModelObject.java:59)
> at library.LibraryModelFactory$CommonLibraryObjectModelObject.eGet(LibraryModelFactory.java:358)
> at library.LibraryModelFactory$WriterModelObject.eGet(LibraryModelFactory.java:447)
> at org.eclipse.emf.texo.converter.ModelEMFConverter.convertSingleEAttribute(ModelEMFConverter.java:407)
> at org.eclipse.emf.texo.converter.ModelEMFConverter.convertContent(ModelEMFConverter.java:183)
> at org.eclipse.emf.texo.converter.ModelEMFConverter.convert(ModelEMFConverter.java:104)
> at tests.library.Test.main(Test.java:55)
>
> It seems that the the attribute "id" has diffrent feature id's and so it was not found on conversion.
>
> Is it a bug or a desing error??
>
> Greetings
> Heiko
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] Issue with FeatureId's [message #1053222 is a reply to message #1052900] Fri, 03 May 2013 08:37 Go to previous messageGo to next message
techteam is currently offline techteam
Messages: 54
Registered: September 2010
Member
Hi Martin,
I do generate only Texo code (including the model package /factory
files) from this model.

After some more test, I found that there is a problem if my abstract
supertype is not on the first position of supertypes.
Here my little test result:

EClass: CommonLibraryObject, EAttributeId: 0, Returned FeatureId from
EClass: 0
EClass: Library, EAttributeId: 0, Returned FeatureId from EClass: 0
EClass: Writer, EAttributeId: 0, Returned FeatureId from EClass: 0
EClass: Publisher, EAttributeId: 0, Returned FeatureId from EClass: 2
EClass: Book, EAttributeId: 0, Returned FeatureId from EClass: 0

On this test all classes have a the abstract class CommonLibraryObject
as supertype.
Writer and publisher have also an interface Person.
The diffrence are that writer has the CommonLibraryObject as first
supertype and publisher has the Person interface as first supertype.

So it seems that an abstract class should be everytime defined as first
supertype inside the ecore model.

As it is with multiple interfaces, I have to test it again later.


Greetings
Heiko

PS: If I have one or the other idea to Texo, should I post them here or
open a bug?

Am 01.05.2013 09:18, schrieb Martin Taal:
> Hi Heiko,
> I need to test myself, I hope to do that within a day. One question, did
> you also generate EMF code from this same model? You debugged and indeed
> the featureid of the id efeature is not inline with what is expected? Or
> is the id efeature not present in the eclass even?
>
> gr. Martin
>
> On 04/30/2013 09:09 AM, Heiko wrote:
>> Hi Martin,
>>
>> first, thanks for the great tool.
>>
>> but at the moment I have a problem with the the conversion from pojo's
>> to EMF model objects.
>>
>> All my classes extends one abstract object and also implements one or
>> more defined interfaces.
>> The generation and my object looks good, but on converting the object,
>> i got message based on wrong feature id's.
>>
>>
>> Thats my simple test code and I attach my model into this message.
>>
>> LibraryModelPackage.initialize();
>>
>> ResourceSet rs = new ResourceSetImpl();
>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
>> new
>> XMIResourceFactoryImpl());
>> URI fileUri = URI.createFileURI("D:/Library.xmi");
>> Resource resource = rs.createResource(fileUri);
>>
>> Library l = new Library();
>> l.setName("Library");
>>
>> List<Object> objects = new ArrayList<Object>();
>> objects.add(l);
>> Writer w = new Writer();
>> w.setFirstName("FirstName");
>> w.setLastName("LastName");
>> l.addToWriters(w);
>>
>> Publisher p = new Publisher();
>> p.setCompany("Company");
>> l.addToPublishers(p);
>>
>> Book b = new Book();
>> b.setTitle("Book");
>> l.addToBooks(b);
>>
>> ModelEMFConverter m2eConverter= new ModelEMFConverter();
>> List<EObject> eObjects = m2eConverter.convert(objects);
>>
>>
>> If I do run these code I've got:
>> Exception in thread "main" java.lang.IllegalArgumentException:
>> EStructuralFeature:
>> org.eclipse.emf.ecore.impl.EAttributeImpl@46f93 (name: id) (ordered:
>> true, unique: true, lowerBound: 0, upperBound: 1)
>> (changeable: true, volatile: false, transient: false,
>> defaultValueLiteral: null, unsettable: false, derived: false) (iD:
>> false) not found in EClass
>> org.eclipse.emf.ecore.impl.EClassImpl@1dbc144 (name: Writer)
>> (instanceClassName: null)
>> (abstract: false, interface: false)
>> at
>> org.eclipse.emf.texo.model.AbstractModelObject.eGet(AbstractModelObject.java:59)
>>
>> at
>> library.LibraryModelFactory$CommonLibraryObjectModelObject.eGet(LibraryModelFactory.java:358)
>>
>> at
>> library.LibraryModelFactory$WriterModelObject.eGet(LibraryModelFactory.java:447)
>>
>> at
>> org.eclipse.emf.texo.converter.ModelEMFConverter.convertSingleEAttribute(ModelEMFConverter.java:407)
>>
>> at
>> org.eclipse.emf.texo.converter.ModelEMFConverter.convertContent(ModelEMFConverter.java:183)
>>
>> at
>> org.eclipse.emf.texo.converter.ModelEMFConverter.convert(ModelEMFConverter.java:104)
>>
>> at tests.library.Test.main(Test.java:55)
>>
>> It seems that the the attribute "id" has diffrent feature id's and so
>> it was not found on conversion.
>>
>> Is it a bug or a desing error??
>>
>> Greetings
>> Heiko
>>
>>
>
>
Re: [Texo] Issue with FeatureId's [message #1053506 is a reply to message #1053222] Mon, 06 May 2013 10:36 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5332
Registered: July 2009
Senior Member
Hi Heiko,
After some debugging I think it is a bug/missing feature on how texo generates the feature ids in the
ModelPackage/ModelFactory code. I entered a bugzilla for this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=407275

and pushed a solution, I am doing a new build. When that passes I will publish a solution.

gr. Martin

On 05/03/2013 10:37 AM, Heiko wrote:
> Hi Martin,
> I do generate only Texo code (including the model package /factory files) from this model.
>
> After some more test, I found that there is a problem if my abstract supertype is not on the first position of supertypes.
> Here my little test result:
>
> EClass: CommonLibraryObject, EAttributeId: 0, Returned FeatureId from EClass: 0
> EClass: Library, EAttributeId: 0, Returned FeatureId from EClass: 0
> EClass: Writer, EAttributeId: 0, Returned FeatureId from EClass: 0
> EClass: Publisher, EAttributeId: 0, Returned FeatureId from EClass: 2
> EClass: Book, EAttributeId: 0, Returned FeatureId from EClass: 0
>
> On this test all classes have a the abstract class CommonLibraryObject as supertype.
> Writer and publisher have also an interface Person.
> The diffrence are that writer has the CommonLibraryObject as first supertype and publisher has the Person interface as
> first supertype.
>
> So it seems that an abstract class should be everytime defined as first supertype inside the ecore model.
>
> As it is with multiple interfaces, I have to test it again later.
>
>
> Greetings
> Heiko
>
> PS: If I have one or the other idea to Texo, should I post them here or open a bug?
>
> Am 01.05.2013 09:18, schrieb Martin Taal:
>> Hi Heiko,
>> I need to test myself, I hope to do that within a day. One question, did
>> you also generate EMF code from this same model? You debugged and indeed
>> the featureid of the id efeature is not inline with what is expected? Or
>> is the id efeature not present in the eclass even?
>>
>> gr. Martin
>>
>> On 04/30/2013 09:09 AM, Heiko wrote:
>>> Hi Martin,
>>>
>>> first, thanks for the great tool.
>>>
>>> but at the moment I have a problem with the the conversion from pojo's
>>> to EMF model objects.
>>>
>>> All my classes extends one abstract object and also implements one or
>>> more defined interfaces.
>>> The generation and my object looks good, but on converting the object,
>>> i got message based on wrong feature id's.
>>>
>>>
>>> Thats my simple test code and I attach my model into this message.
>>>
>>> LibraryModelPackage.initialize();
>>>
>>> ResourceSet rs = new ResourceSetImpl();
>>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
>>> new
>>> XMIResourceFactoryImpl());
>>> URI fileUri = URI.createFileURI("D:/Library.xmi");
>>> Resource resource = rs.createResource(fileUri);
>>>
>>> Library l = new Library();
>>> l.setName("Library");
>>>
>>> List<Object> objects = new ArrayList<Object>();
>>> objects.add(l);
>>> Writer w = new Writer();
>>> w.setFirstName("FirstName");
>>> w.setLastName("LastName");
>>> l.addToWriters(w);
>>>
>>> Publisher p = new Publisher();
>>> p.setCompany("Company");
>>> l.addToPublishers(p);
>>>
>>> Book b = new Book();
>>> b.setTitle("Book");
>>> l.addToBooks(b);
>>>
>>> ModelEMFConverter m2eConverter= new ModelEMFConverter();
>>> List<EObject> eObjects = m2eConverter.convert(objects);
>>>
>>>
>>> If I do run these code I've got:
>>> Exception in thread "main" java.lang.IllegalArgumentException:
>>> EStructuralFeature:
>>> org.eclipse.emf.ecore.impl.EAttributeImpl@46f93 (name: id) (ordered:
>>> true, unique: true, lowerBound: 0, upperBound: 1)
>>> (changeable: true, volatile: false, transient: false,
>>> defaultValueLiteral: null, unsettable: false, derived: false) (iD:
>>> false) not found in EClass
>>> org.eclipse.emf.ecore.impl.EClassImpl@1dbc144 (name: Writer)
>>> (instanceClassName: null)
>>> (abstract: false, interface: false)
>>> at
>>> org.eclipse.emf.texo.model.AbstractModelObject.eGet(AbstractModelObject.java:59)
>>>
>>> at
>>> library.LibraryModelFactory$CommonLibraryObjectModelObject.eGet(LibraryModelFactory.java:358)
>>>
>>> at
>>> library.LibraryModelFactory$WriterModelObject.eGet(LibraryModelFactory.java:447)
>>>
>>> at
>>> org.eclipse.emf.texo.converter.ModelEMFConverter.convertSingleEAttribute(ModelEMFConverter.java:407)
>>>
>>> at
>>> org.eclipse.emf.texo.converter.ModelEMFConverter.convertContent(ModelEMFConverter.java:183)
>>>
>>> at
>>> org.eclipse.emf.texo.converter.ModelEMFConverter.convert(ModelEMFConverter.java:104)
>>>
>>> at tests.library.Test.main(Test.java:55)
>>>
>>> It seems that the the attribute "id" has diffrent feature id's and so
>>> it was not found on conversion.
>>>
>>> Is it a bug or a desing error??
>>>
>>> Greetings
>>> Heiko
>>>
>>>
>>
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] Issue with FeatureId's [message #1053517 is a reply to message #1053222] Mon, 06 May 2013 11:08 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5332
Registered: July 2009
Senior Member
Hi Heiko,
I published a new build which should solve this.

gr. Martin

On 05/03/2013 10:37 AM, Heiko wrote:
> Hi Martin,
> I do generate only Texo code (including the model package /factory files) from this model.
>
> After some more test, I found that there is a problem if my abstract supertype is not on the first position of supertypes.
> Here my little test result:
>
> EClass: CommonLibraryObject, EAttributeId: 0, Returned FeatureId from EClass: 0
> EClass: Library, EAttributeId: 0, Returned FeatureId from EClass: 0
> EClass: Writer, EAttributeId: 0, Returned FeatureId from EClass: 0
> EClass: Publisher, EAttributeId: 0, Returned FeatureId from EClass: 2
> EClass: Book, EAttributeId: 0, Returned FeatureId from EClass: 0
>
> On this test all classes have a the abstract class CommonLibraryObject as supertype.
> Writer and publisher have also an interface Person.
> The diffrence are that writer has the CommonLibraryObject as first supertype and publisher has the Person interface as
> first supertype.
>
> So it seems that an abstract class should be everytime defined as first supertype inside the ecore model.
>
> As it is with multiple interfaces, I have to test it again later.
>
>
> Greetings
> Heiko
>
> PS: If I have one or the other idea to Texo, should I post them here or open a bug?
>
> Am 01.05.2013 09:18, schrieb Martin Taal:
>> Hi Heiko,
>> I need to test myself, I hope to do that within a day. One question, did
>> you also generate EMF code from this same model? You debugged and indeed
>> the featureid of the id efeature is not inline with what is expected? Or
>> is the id efeature not present in the eclass even?
>>
>> gr. Martin
>>
>> On 04/30/2013 09:09 AM, Heiko wrote:
>>> Hi Martin,
>>>
>>> first, thanks for the great tool.
>>>
>>> but at the moment I have a problem with the the conversion from pojo's
>>> to EMF model objects.
>>>
>>> All my classes extends one abstract object and also implements one or
>>> more defined interfaces.
>>> The generation and my object looks good, but on converting the object,
>>> i got message based on wrong feature id's.
>>>
>>>
>>> Thats my simple test code and I attach my model into this message.
>>>
>>> LibraryModelPackage.initialize();
>>>
>>> ResourceSet rs = new ResourceSetImpl();
>>> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
>>> new
>>> XMIResourceFactoryImpl());
>>> URI fileUri = URI.createFileURI("D:/Library.xmi");
>>> Resource resource = rs.createResource(fileUri);
>>>
>>> Library l = new Library();
>>> l.setName("Library");
>>>
>>> List<Object> objects = new ArrayList<Object>();
>>> objects.add(l);
>>> Writer w = new Writer();
>>> w.setFirstName("FirstName");
>>> w.setLastName("LastName");
>>> l.addToWriters(w);
>>>
>>> Publisher p = new Publisher();
>>> p.setCompany("Company");
>>> l.addToPublishers(p);
>>>
>>> Book b = new Book();
>>> b.setTitle("Book");
>>> l.addToBooks(b);
>>>
>>> ModelEMFConverter m2eConverter= new ModelEMFConverter();
>>> List<EObject> eObjects = m2eConverter.convert(objects);
>>>
>>>
>>> If I do run these code I've got:
>>> Exception in thread "main" java.lang.IllegalArgumentException:
>>> EStructuralFeature:
>>> org.eclipse.emf.ecore.impl.EAttributeImpl@46f93 (name: id) (ordered:
>>> true, unique: true, lowerBound: 0, upperBound: 1)
>>> (changeable: true, volatile: false, transient: false,
>>> defaultValueLiteral: null, unsettable: false, derived: false) (iD:
>>> false) not found in EClass
>>> org.eclipse.emf.ecore.impl.EClassImpl@1dbc144 (name: Writer)
>>> (instanceClassName: null)
>>> (abstract: false, interface: false)
>>> at
>>> org.eclipse.emf.texo.model.AbstractModelObject.eGet(AbstractModelObject.java:59)
>>>
>>> at
>>> library.LibraryModelFactory$CommonLibraryObjectModelObject.eGet(LibraryModelFactory.java:358)
>>>
>>> at
>>> library.LibraryModelFactory$WriterModelObject.eGet(LibraryModelFactory.java:447)
>>>
>>> at
>>> org.eclipse.emf.texo.converter.ModelEMFConverter.convertSingleEAttribute(ModelEMFConverter.java:407)
>>>
>>> at
>>> org.eclipse.emf.texo.converter.ModelEMFConverter.convertContent(ModelEMFConverter.java:183)
>>>
>>> at
>>> org.eclipse.emf.texo.converter.ModelEMFConverter.convert(ModelEMFConverter.java:104)
>>>
>>> at tests.library.Test.main(Test.java:55)
>>>
>>> It seems that the the attribute "id" has diffrent feature id's and so
>>> it was not found on conversion.
>>>
>>> Is it a bug or a desing error??
>>>
>>> Greetings
>>> Heiko
>>>
>>>
>>
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:[MWE2] Help executing mwe2 workflows from java
Next Topic:Epatch in current EMF Compare
Goto Forum:
  


Current Time: Sun Sep 21 20:31:45 GMT 2014

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

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