Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » EMF Iterate through an String array
EMF Iterate through an String array [message #32443] Wed, 05 September 2007 15:25 Go to next message
Tex Twil is currently offline Tex TwilFriend
Messages: 179
Registered: July 2009
Senior Member
Hi again,
I've been stuck on a problem even I know that the solution must be simple.
How can I iterate on a attribute of a class which is a String array to get
all the values from this array ?

I tried

<c:iterate select="$myClass/@myStringArray" var="myValue">
<c:get select="$myValue" />
</c:iterate>

but this only gets me the 1st value of the array.

Thank,
regards,
Tex
Re: EMF Iterate through an String array [message #32548 is a reply to message #32443] Thu, 06 September 2007 09:03 Go to previous messageGo to next message
Tex Twil is currently offline Tex TwilFriend
Messages: 179
Registered: July 2009
Senior Member
Hi,
more details about my question. This is a part of my xmi EMF model:

<rooms name="idRoom">
<compartments>A</compartments>
<compartments>B</compartments>
<compartments>C</compartments>
<compartments>D</compartments>
</rooms>

All I want is to iterate through the "compartments" of the current "room"
access the A, B .. compartments. It's seems quite easy but I'm stuck. I
tried
$currRoom/child::compartments
but it doesn't seem to work.

Thanks


"Tex Twil" <chaljan@hotmail.com> a écrit dans le message de
news:fbmhp2$7ph$1@build.eclipse.org...
> Hi again,
> I've been stuck on a problem even I know that the solution must be simple.
> How can I iterate on a attribute of a class which is a String array to get
> all the values from this array ?
>
> I tried
>
> <c:iterate select="$myClass/@myStringArray" var="myValue">
> <c:get select="$myValue" />
> </c:iterate>
>
> but this only gets me the 1st value of the array.
>
> Thank,
> regards,
> Tex
>
Re: EMF Iterate through an String array [message #32616 is a reply to message #32548] Thu, 06 September 2007 11:04 Go to previous messageGo to next message
Tex Twil is currently offline Tex TwilFriend
Messages: 179
Registered: July 2009
Senior Member
This was my first try but it doesn't work

<c:iterate select="$currRoom/compartments" var="currCompartment" >
<c:get select="$currCompartment" />
</c:iterate>

I realized that if I write an "@" in <c:iterate
select="$currRoom/@compartments" var="currCompartment" > I access the value
of the first compartment i.e. "A".

Thanks
Tex

"Tex Twil" <chaljan@hotmail.com> a écrit dans le message de
news:fbofon$1m7$1@build.eclipse.org...
> Hi,
> more details about my question. This is a part of my xmi EMF model:
>
> <rooms name="idRoom">
> <compartments>A</compartments>
> <compartments>B</compartments>
> <compartments>C</compartments>
> <compartments>D</compartments>
> </rooms>
>
> All I want is to iterate through the "compartments" of the current "room"
> access the A, B .. compartments. It's seems quite easy but I'm stuck. I
> tried
> $currRoom/child::compartments
> but it doesn't seem to work.
>
> Thanks
>
>
> "Tex Twil" <chaljan@hotmail.com> a écrit dans le message de
> news:fbmhp2$7ph$1@build.eclipse.org...
>> Hi again,
>> I've been stuck on a problem even I know that the solution must be
>> simple. How can I iterate on a attribute of a class which is a String
>> array to get all the values from this array ?
>>
>> I tried
>>
>> <c:iterate select="$myClass/@myStringArray" var="myValue">
>> <c:get select="$myValue" />
>> </c:iterate>
>>
>> but this only gets me the 1st value of the array.
>>
>> Thank,
>> regards,
>> Tex
>>
>
Re: EMF Iterate through an String array [message #32752 is a reply to message #32616] Thu, 06 September 2007 12:22 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Tex:

I wouldn't be surprised if JET does not handle attribute arrays properly.
Please submit a defect:

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=M2T& version=unspecified&component=Jet&rep_platform=PC&am p;op_sys=Windows%20XP&priority=P3&bug_severity=norma l&bug_status=NEW&bug_file_loc=http%3A%2F%2F&shor t_desc=&comment=&commentprivacy=0&keywords=& dependson=&blocked=&maketemplate=Remember%20values%2 0as%20bookmarkable%20template&form_name=enter_bug&as signed_to=m2t.jet-inbox%40eclipse.org

Paul

"Tex Twil" <chaljan@hotmail.com> wrote in message
news:fbomrm$csc$1@build.eclipse.org...
> This was my first try but it doesn't work
>
> <c:iterate select="$currRoom/compartments" var="currCompartment" >
> <c:get select="$currCompartment" />
> </c:iterate>
>
> I realized that if I write an "@" in <c:iterate
> select="$currRoom/@compartments" var="currCompartment" > I access the
> value of the first compartment i.e. "A".
>
> Thanks
> Tex
>
> "Tex Twil" <chaljan@hotmail.com> a
Re: EMF Iterate through an String array [message #32921 is a reply to message #32752] Thu, 06 September 2007 13:44 Go to previous messageGo to next message
Tex Twil is currently offline Tex TwilFriend
Messages: 179
Registered: July 2009
Senior Member
Hi,
it seems that a string array is stored in a xmi file as I wrote before i.e.

myClass
String name
String[] myArray

An instance of this class is stored in xmi:

<myClass name="This is my class">
<myArray>A</myArray>
<myArray>B</myArray>
<myArray>C</myArray>
</myClass>

So it should be possible to iterate through those <myArray> to get the
values. (see my other posts) :)

Tex.



"Paul Elder" <pelder@ca.ibm.com> a écrit dans le message de
news:fborgc$lms$1@build.eclipse.org...
> Tex:
>
> I wouldn't be surprised if JET does not handle attribute arrays properly.
> Please submit a defect:
>
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=M2T& version=unspecified&component=Jet&rep_platform=PC&am p;op_sys=Windows%20XP&priority=P3&bug_severity=norma l&bug_status=NEW&bug_file_loc=http%3A%2F%2F&shor t_desc=&comment=&commentprivacy=0&keywords=& dependson=&blocked=&maketemplate=Remember%20values%2 0as%20bookmarkable%20template&form_name=enter_bug&as signed_to=m2t.jet-inbox%40eclipse.org
>
> Paul
>
> "Tex Twil" <chaljan@hotmail.com> wrote in message
> news:fbomrm$csc$1@build.eclipse.org...
>> This was my first try but it doesn't work
>>
>> <c:iterate select="$currRoom/compartments" var="currCompartment" >
>> <c:get select="$currCompartment" />
>> </c:iterate>
>>
>> I realized that if I write an "@" in <c:iterate
>> select="$currRoom/@compartments" var="currCompartment" > I access the
>> value of the first compartment i.e. "A".
>>
>> Thanks
>> Tex
>>
>> "Tex Twil" <chaljan@hotmail.com> a écrit dans le message de
>> news:fbofon$1m7$1@build.eclipse.org...
>>> Hi,
>>> more details about my question. This is a part of my xmi EMF model:
>>>
>>> <rooms name="idRoom">
>>> <compartments>A</compartments>
>>> <compartments>B</compartments>
>>> <compartments>C</compartments>
>>> <compartments>D</compartments>
>>> </rooms>
>>>
>>> All I want is to iterate through the "compartments" of the current
>>> "room" access the A, B .. compartments. It's seems quite easy but I'm
>>> stuck. I tried
>>> $currRoom/child::compartments
>>> but it doesn't seem to work.
>>>
>>> Thanks
>>>
>>>
>>> "Tex Twil" <chaljan@hotmail.com> a écrit dans le message de
>>> news:fbmhp2$7ph$1@build.eclipse.org...
>>>> Hi again,
>>>> I've been stuck on a problem even I know that the solution must be
>>>> simple. How can I iterate on a attribute of a class which is a String
>>>> array to get all the values from this array ?
>>>>
>>>> I tried
>>>>
>>>> <c:iterate select="$myClass/@myStringArray" var="myValue">
>>>> <c:get select="$myValue" />
>>>> </c:iterate>
>>>>
>>>> but this only gets me the 1st value of the array.
>>>>
>>>> Thank,
>>>> regards,
>>>> Tex
>>>>
>>>
>>
>
>
Re: EMF Iterate through an String array [message #33024 is a reply to message #32921] Thu, 06 September 2007 15:06 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Tex:

But JET does not read the XMI file, EMF does. What JET sees is EObjects and
their corresponding EMF metadata (EClasses, EReferences and EAttributes).
JET has no idea how the model was represented on disk. It could be an XMI
file, as in your case, a relational data base (which you can do with Teneo),
or any number of other possibilities.

JET is attempting to map EReferences to XPath Elements, and EAttributes to
XPath Attributes. But, XPath does not have a concept of arrays, and so, an
Attribute that is an array is a problem. The only 'fix' I can imagine is, on
finding an array is to treat is like an XPath Element. I will investigate.

In the meantime, if you want to make progress with the way JET is currently
implemented, I can suggest the following work arounds (all involve modifying
your Ecore meta-model).

1) Instead of using arrays of simple types (e.g. String), create an EClass
to represent the object, have it define an attribute for the value, and then
create a multi-valued, containment EReference instead of an EAttribute
array.

2) If you are familiar with the EMF annotations for XML Schema, you may be
able to add the right annotations to get JET to look at the EAttribute as a
'simple' Element.

An example. I can describe your myClass example as the attached
texschema.xsd XML Schema.

If you create an EMF Project from this schema, you get a ECore model like
the attached texschema.ecore. In particular, not that the myArray attribute
has an ExtendedMetaData annotation that indicates that the attribute is to
be treated as an XML element. JET understands these. You may be able to just
hack one of these into your ECore model, and JET will magically understand
that the array attribute should be treated as an XPath element. (I say 'may'
because, I'm not sure whether EMFs extended meta data mechanism works if
there isn't extended metadata attached to the EPackage itself. My theory is
you could get away with just by hacking in the following annotation:

<eStructuralFeatures xsi:type="ecore:EAttribute" name="myArray"
unique="false"
upperBound="-1" eType="ecore:EDataType
http://www.eclipse.org/emf/2003/XMLType#//String">
<!-- start of hack --!>
<eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
</eAnnotations>
<!-- end of hack --!>
</eStructuralFeatures>

Paul

"Tex Twil" <chaljan@hotmail.com> wrote in message
news:fbp078$q5v$1@build.eclipse.org...
> Hi,
> it seems that a string array is stored in a xmi file as I wrote before
> i.e.
>
> myClass
> String name
> String[] myArray
>
> An instance of this class is stored in xmi:
>
> <myClass name="This is my class">
> <myArray>A</myArray>
> <myArray>B</myArray>
> <myArray>C</myArray>
> </myClass>
>
> So it should be possible to iterate through those <myArray> to get the
> values. (see my other posts) :)
>
> Tex.
>
>
>
> "Paul Elder" <pelder@ca.ibm.com> a
Re: EMF Iterate through an String array [message #33096 is a reply to message #33024] Thu, 06 September 2007 15:11 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Forgot the attach the texschema.ecore model.

Here it is.

Paul


Re: EMF Iterate through an String array [message #33166 is a reply to message #33024] Thu, 06 September 2007 15:34 Go to previous messageGo to next message
Tex Twil is currently offline Tex TwilFriend
Messages: 179
Registered: July 2009
Senior Member
Thank you Paul,
I understand the problem better now.
I will try those solutions and let you know.

regards,
Tex
"Paul Elder" <pelder@ca.ibm.com> a écrit dans le message de
news:fbp53h$tig$1@build.eclipse.org...
> Tex:
>
> But JET does not read the XMI file, EMF does. What JET sees is EObjects
> and their corresponding EMF metadata (EClasses, EReferences and
> EAttributes). JET has no idea how the model was represented on disk. It
> could be an XMI file, as in your case, a relational data base (which you
> can do with Teneo), or any number of other possibilities.
>
> JET is attempting to map EReferences to XPath Elements, and EAttributes to
> XPath Attributes. But, XPath does not have a concept of arrays, and so, an
> Attribute that is an array is a problem. The only 'fix' I can imagine is,
> on finding an array is to treat is like an XPath Element. I will
> investigate.
>
> In the meantime, if you want to make progress with the way JET is
> currently implemented, I can suggest the following work arounds (all
> involve modifying your Ecore meta-model).
>
> 1) Instead of using arrays of simple types (e.g. String), create an EClass
> to represent the object, have it define an attribute for the value, and
> then create a multi-valued, containment EReference instead of an
> EAttribute array.
>
> 2) If you are familiar with the EMF annotations for XML Schema, you may be
> able to add the right annotations to get JET to look at the EAttribute as
> a 'simple' Element.
>
> An example. I can describe your myClass example as the attached
> texschema.xsd XML Schema.
>
> If you create an EMF Project from this schema, you get a ECore model like
> the attached texschema.ecore. In particular, not that the myArray
> attribute has an ExtendedMetaData annotation that indicates that the
> attribute is to be treated as an XML element. JET understands these. You
> may be able to just hack one of these into your ECore model, and JET will
> magically understand that the array attribute should be treated as an
> XPath element. (I say 'may' because, I'm not sure whether EMFs extended
> meta data mechanism works if there isn't extended metadata attached to the
> EPackage itself. My theory is you could get away with just by hacking in
> the following annotation:
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="myArray"
> unique="false"
> upperBound="-1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2003/XMLType#//String">
> <!-- start of hack --!>
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> </eAnnotations>
> <!-- end of hack --!>
> </eStructuralFeatures>
>
> Paul
>
> "Tex Twil" <chaljan@hotmail.com> wrote in message
> news:fbp078$q5v$1@build.eclipse.org...
>> Hi,
>> it seems that a string array is stored in a xmi file as I wrote before
>> i.e.
>>
>> myClass
>> String name
>> String[] myArray
>>
>> An instance of this class is stored in xmi:
>>
>> <myClass name="This is my class">
>> <myArray>A</myArray>
>> <myArray>B</myArray>
>> <myArray>C</myArray>
>> </myClass>
>>
>> So it should be possible to iterate through those <myArray> to get the
>> values. (see my other posts) :)
>>
>> Tex.
>>
>>
>>
>> "Paul Elder" <pelder@ca.ibm.com> a écrit dans le message de
>> news:fborgc$lms$1@build.eclipse.org...
>>> Tex:
>>>
>>> I wouldn't be surprised if JET does not handle attribute arrays
>>> properly.
>>> Please submit a defect:
>>>
>>> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=M2T& version=unspecified&component=Jet&rep_platform=PC&am p;op_sys=Windows%20XP&priority=P3&bug_severity=norma l&bug_status=NEW&bug_file_loc=http%3A%2F%2F&shor t_desc=&comment=&commentprivacy=0&keywords=& dependson=&blocked=&maketemplate=Remember%20values%2 0as%20bookmarkable%20template&form_name=enter_bug&as signed_to=m2t.jet-inbox%40eclipse.org
>>>
>>> Paul
>>>
>>> "Tex Twil" <chaljan@hotmail.com> wrote in message
>>> news:fbomrm$csc$1@build.eclipse.org...
>>>> This was my first try but it doesn't work
>>>>
>>>> <c:iterate select="$currRoom/compartments" var="currCompartment" >
>>>> <c:get select="$currCompartment" />
>>>> </c:iterate>
>>>>
>>>> I realized that if I write an "@" in <c:iterate
>>>> select="$currRoom/@compartments" var="currCompartment" > I access the
>>>> value of the first compartment i.e. "A".
>>>>
>>>> Thanks
>>>> Tex
>>>>
>>>> "Tex Twil" <chaljan@hotmail.com> a écrit dans le message de
>>>> news:fbofon$1m7$1@build.eclipse.org...
>>>>> Hi,
>>>>> more details about my question. This is a part of my xmi EMF model:
>>>>>
>>>>> <rooms name="idRoom">
>>>>> <compartments>A</compartments>
>>>>> <compartments>B</compartments>
>>>>> <compartments>C</compartments>
>>>>> <compartments>D</compartments>
>>>>> </rooms>
>>>>>
>>>>> All I want is to iterate through the "compartments" of the current
>>>>> "room" access the A, B .. compartments. It's seems quite easy but I'm
>>>>> stuck. I tried
>>>>> $currRoom/child::compartments
>>>>> but it doesn't seem to work.
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>> "Tex Twil" <chaljan@hotmail.com> a écrit dans le message de
>>>>> news:fbmhp2$7ph$1@build.eclipse.org...
>>>>>> Hi again,
>>>>>> I've been stuck on a problem even I know that the solution must be
>>>>>> simple. How can I iterate on a attribute of a class which is a String
>>>>>> array to get all the values from this array ?
>>>>>>
>>>>>> I tried
>>>>>>
>>>>>> <c:iterate select="$myClass/@myStringArray" var="myValue">
>>>>>> <c:get select="$myValue" />
>>>>>> </c:iterate>
>>>>>>
>>>>>> but this only gets me the 1st value of the array.
>>>>>>
>>>>>> Thank,
>>>>>> regards,
>>>>>> Tex
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>
>
Re: EMF Iterate through an String array [message #33237 is a reply to message #33024] Fri, 07 September 2007 08:55 Go to previous messageGo to next message
Tex Twil is currently offline Tex TwilFriend
Messages: 179
Registered: July 2009
Senior Member
Hi Paul,
I'm not really familiar with EMF annotations for XML , nevertheless, I tried
your second solution.
I tried your "hack" and I attached an EAnnotation only to the myArray
attribute (kind -> element)

When I derive the ecore to the genmodel and then generate the Model code I
have some compilation errors, some of them saying that
org.eclipse.emf.ecore.xmi cannont be resolved.

When I do the same wih your attached ecore (where the EAnnotations are
everywhere) I don't have those errors. What am I doing wrong ?

regards,
Tex.


"Paul Elder" <pelder@ca.ibm.com> a écrit dans le message de
news:fbp53h$tig$1@build.eclipse.org...
> Tex:
>
> But JET does not read the XMI file, EMF does. What JET sees is EObjects
> and their corresponding EMF metadata (EClasses, EReferences and
> EAttributes). JET has no idea how the model was represented on disk. It
> could be an XMI file, as in your case, a relational data base (which you
> can do with Teneo), or any number of other possibilities.
>
> JET is attempting to map EReferences to XPath Elements, and EAttributes to
> XPath Attributes. But, XPath does not have a concept of arrays, and so, an
> Attribute that is an array is a problem. The only 'fix' I can imagine is,
> on finding an array is to treat is like an XPath Element. I will
> investigate.
>
> In the meantime, if you want to make progress with the way JET is
> currently implemented, I can suggest the following work arounds (all
> involve modifying your Ecore meta-model).
>
> 1) Instead of using arrays of simple types (e.g. String), create an EClass
> to represent the object, have it define an attribute for the value, and
> then create a multi-valued, containment EReference instead of an
> EAttribute array.
>
> 2) If you are familiar with the EMF annotations for XML Schema, you may be
> able to add the right annotations to get JET to look at the EAttribute as
> a 'simple' Element.
>
> An example. I can describe your myClass example as the attached
> texschema.xsd XML Schema.
>
> If you create an EMF Project from this schema, you get a ECore model like
> the attached texschema.ecore. In particular, not that the myArray
> attribute has an ExtendedMetaData annotation that indicates that the
> attribute is to be treated as an XML element. JET understands these. You
> may be able to just hack one of these into your ECore model, and JET will
> magically understand that the array attribute should be treated as an
> XPath element. (I say 'may' because, I'm not sure whether EMFs extended
> meta data mechanism works if there isn't extended metadata attached to the
> EPackage itself. My theory is you could get away with just by hacking in
> the following annotation:
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="myArray"
> unique="false"
> upperBound="-1" eType="ecore:EDataType
> http://www.eclipse.org/emf/2003/XMLType#//String">
> <!-- start of hack --!>
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> </eAnnotations>
> <!-- end of hack --!>
> </eStructuralFeatures>
>
> Paul
>
> "Tex Twil" <chaljan@hotmail.com> wrote in message
> news:fbp078$q5v$1@build.eclipse.org...
>> Hi,
>> it seems that a string array is stored in a xmi file as I wrote before
>> i.e.
>>
>> myClass
>> String name
>> String[] myArray
>>
>> An instance of this class is stored in xmi:
>>
>> <myClass name="This is my class">
>> <myArray>A</myArray>
>> <myArray>B</myArray>
>> <myArray>C</myArray>
>> </myClass>
>>
>> So it should be possible to iterate through those <myArray> to get the
>> values. (see my other posts) :)
>>
>> Tex.
>>
>>
>>
>> "Paul Elder" <pelder@ca.ibm.com> a écrit dans le message de
>> news:fborgc$lms$1@build.eclipse.org...
>>> Tex:
>>>
>>> I wouldn't be surprised if JET does not handle attribute arrays
>>> properly.
>>> Please submit a defect:
>>>
>>> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=M2T& version=unspecified&component=Jet&rep_platform=PC&am p;op_sys=Windows%20XP&priority=P3&bug_severity=norma l&bug_status=NEW&bug_file_loc=http%3A%2F%2F&shor t_desc=&comment=&commentprivacy=0&keywords=& dependson=&blocked=&maketemplate=Remember%20values%2 0as%20bookmarkable%20template&form_name=enter_bug&as signed_to=m2t.jet-inbox%40eclipse.org
>>>
>>> Paul
>>>
>>> "Tex Twil" <chaljan@hotmail.com> wrote in message
>>> news:fbomrm$csc$1@build.eclipse.org...
>>>> This was my first try but it doesn't work
>>>>
>>>> <c:iterate select="$currRoom/compartments" var="currCompartment" >
>>>> <c:get select="$currCompartment" />
>>>> </c:iterate>
>>>>
>>>> I realized that if I write an "@" in <c:iterate
>>>> select="$currRoom/@compartments" var="currCompartment" > I access the
>>>> value of the first compartment i.e. "A".
>>>>
>>>> Thanks
>>>> Tex
>>>>
>>>> "Tex Twil" <chaljan@hotmail.com> a écrit dans le message de
>>>> news:fbofon$1m7$1@build.eclipse.org...
>>>>> Hi,
>>>>> more details about my question. This is a part of my xmi EMF model:
>>>>>
>>>>> <rooms name="idRoom">
>>>>> <compartments>A</compartments>
>>>>> <compartments>B</compartments>
>>>>> <compartments>C</compartments>
>>>>> <compartments>D</compartments>
>>>>> </rooms>
>>>>>
>>>>> All I want is to iterate through the "compartments" of the current
>>>>> "room" access the A, B .. compartments. It's seems quite easy but I'm
>>>>> stuck. I tried
>>>>> $currRoom/child::compartments
>>>>> but it doesn't seem to work.
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>> "Tex Twil" <chaljan@hotmail.com> a écrit dans le message de
>>>>> news:fbmhp2$7ph$1@build.eclipse.org...
>>>>>> Hi again,
>>>>>> I've been stuck on a problem even I know that the solution must be
>>>>>> simple. How can I iterate on a attribute of a class which is a String
>>>>>> array to get all the values from this array ?
>>>>>>
>>>>>> I tried
>>>>>>
>>>>>> <c:iterate select="$myClass/@myStringArray" var="myValue">
>>>>>> <c:get select="$myValue" />
>>>>>> </c:iterate>
>>>>>>
>>>>>> but this only gets me the 1st value of the array.
>>>>>>
>>>>>> Thank,
>>>>>> regards,
>>>>>> Tex
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>
>
Re: EMF Iterate through an String array [message #33307 is a reply to message #33237] Fri, 07 September 2007 12:30 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Tex:

Well, I'm not exactly sure what's going wrong :-)

You are getting Java compilation errors, so the first thing I would do is
compare the dependencies of the two plug-ins.

Paul

"Tex Twil" <chaljan@hotmail.com> wrote in message
news:fbr3mf$bb5$1@build.eclipse.org...
> Hi Paul,
> I'm not really familiar with EMF annotations for XML , nevertheless, I
> tried your second solution.
> I tried your "hack" and I attached an EAnnotation only to the myArray
> attribute (kind -> element)
>
> When I derive the ecore to the genmodel and then generate the Model code I
> have some compilation errors, some of them saying that
> org.eclipse.emf.ecore.xmi cannont be resolved.
>
> When I do the same wih your attached ecore (where the EAnnotations are
> everywhere) I don't have those errors. What am I doing wrong ?
>
> regards,
> Tex.
>
>
> "Paul Elder" <pelder@ca.ibm.com> a
Re: EMF Iterate through an String array [message #35534 is a reply to message #32443] Wed, 07 November 2007 04:34 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

I have also hit this same bug. Does anybody know if this has been reported
as an issue, if there is a fix, one itwill come through. This is a serious
glitch! How many metamodels do not use multiplity many attributes? Very few,
I presume ...

"Tex Twil" <chaljan@hotmail.com> wrote in message
news:fbmhp2$7ph$1@build.eclipse.org...
> Hi again,
> I've been stuck on a problem even I know that the solution must be simple.
> How can I iterate on a attribute of a class which is a String array to get
> all the values from this array ?
>
> I tried
>
> <c:iterate select="$myClass/@myStringArray" var="myValue">
> <c:get select="$myValue" />
> </c:iterate>
>
> but this only gets me the 1st value of the array.
>
> Thank,
> regards,
> Tex
>
Bug: Values of Multiplicity Many attribute ignored in EMF to JET mapping [message #35568 is a reply to message #35534] Wed, 07 November 2007 04:43 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Bug: Values of Multiplicity Many attribute ignored in EMF to JET mapping
description:

For a multiplicity-many eAttribute attr of an instance of eClass class, with
any number of entries above one, the following xpath expression ALWAYS
results in 1, when it should provide the number of attribute nodes.

<c:get select="count($instance/@attr)"/>

This also means that iteration over the ignored nodes is not possible.


"J
Re: Values of Multiplicity Many attribute ignored in EMF to JET mapping [message #35601 is a reply to message #35568] Wed, 07 November 2007 06:12 Go to previous message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Further, you can observe that the bug is in the model loader, as any

<c:dump select="$instance"/>

will only show the first value.

"J
Previous Topic:Re: [JET] Switching on eClass()
Next Topic:Bug: Values of Multiplicity Many attribute ignored in EMF to JET mapping
Goto Forum:
  


Current Time: Sat Apr 20 03:42:50 GMT 2024

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

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

Back to the top