Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Re: [OCL/QVTO] Accessing a EFeatureMapEntry
Re: [OCL/QVTO] Accessing a EFeatureMapEntry [message #546901] Wed, 14 July 2010 14:48 Go to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Christophe,

It's news://new.eclipse.org/eclipse.modeling.mdt.ocl I've added it to
the "to" list of the reply, so no need to repost.


Christophe Bouhier wrote:
> Ed,
>
> I posted this question first on the M2M group and then thought, it
> might be more of an OCL question. Sorry, not sure where OCL questions go?
>
> rgds Christophe
>
>
>> Christophe,
>>
>> Comments below.
>>
>>
>> Christophe Bouhier wrote:
>>> Hi,
>>>
>>> I am try to read the value of an EFeatureMapEntry.
>>>
>>>
>>> In the query below, I first query the type 'DataType1' which has a
>>> EFeatureMap and I request the first entry (using ->at(1)).
>>>
>>>
>>>
>>>
>>> query XLS::DataType1::toData() : ECORE::EFeatureMapEntry {
>>> log("QUERY: Data", self.mixed->at(1));
>>> return self.mixed->at(1);
>>> }
>>>
>>> The log on this reports the following type: data:ecore.xml.type:text
>>>
>>>
>>> then, I use the result to get the value as a String.
>>> I try to convert to a Sequence
>> What's that?
>>> and get the second index which is
>>> supposed to be the value in the EFeatureMapEntry but this doesn't work.
>> Hmmm.
>>> It seems overcomplicated anyway.
>>>
>>> query XLS::CellType::toCell() : String {
>>> log("QUERY: Cell", self);
>>> return
>>> self.data->toData()->asSequence()->at(2).oclAsType(String);
>>> }
>>>
>>>
>>> Any ideas to access the EFeatureMapEntry?
>> Sounds like a question for the OCL or QVTo newsgroup. Maybe Ed
>> Willink will see your question here.
>>>
>>> thanks, Christophe


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [OCL/QVTO] Accessing a EFeatureMapEntry [message #546939 is a reply to message #546901] Wed, 14 July 2010 16:22 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Christophe

The simple answer is no chance.

The MDT/UML2 project has capabilities to convert advanced UML
associations such as {subsets} to Ecore with special EAnnotations that
genmodel recognises. Some of these are realised by EFeatureMap.

The MDT/OCL project provides abilities to use OCL expressions on UML or
Ecore meta-models, however I am not aware of any MDT/OCL functionality
that is able to recognise the UML idiom in Ecore and so allow the UML
syntax to be used in OCL. (It is just possible that this functionality
may appear in MDT/OCL for Indigo.)

In practice, EFeatureMap is just the type of an EAttribute so you may be
able to use it as an EDataType. Or you may code custom Java helpers to
perform useful actions on the EDataType.

Regards

Ed Willink



On 14/07/2010 15:48, Ed Merks wrote:
> Christophe,
>
> It's news://new.eclipse.org/eclipse.modeling.mdt.ocl I've added it to
> the "to" list of the reply, so no need to repost.
>
>
> Christophe Bouhier wrote:
>> Ed,
>>
>> I posted this question first on the M2M group and then thought, it
>> might be more of an OCL question. Sorry, not sure where OCL questions go?
>>
>> rgds Christophe
>>
>>
>>> Christophe,
>>>
>>> Comments below.
>>>
>>>
>>> Christophe Bouhier wrote:
>>>> Hi,
>>>>
>>>> I am try to read the value of an EFeatureMapEntry.
>>>>
>>>>
>>>> In the query below, I first query the type 'DataType1' which has a
>>>> EFeatureMap and I request the first entry (using ->at(1)).
>>>>
>>>>
>>>>
>>>>
>>>> query XLS::DataType1::toData() : ECORE::EFeatureMapEntry {
>>>> log("QUERY: Data", self.mixed->at(1));
>>>> return self.mixed->at(1);
>>>> }
>>>>
>>>> The log on this reports the following type: data:ecore.xml.type:text
>>>>
>>>>
>>>> then, I use the result to get the value as a String.
>>>> I try to convert to a Sequence
>>> What's that?
>>>> and get the second index which is
>>>> supposed to be the value in the EFeatureMapEntry but this doesn't work.
>>> Hmmm.
>>>> It seems overcomplicated anyway.
>>>>
>>>> query XLS::CellType::toCell() : String {
>>>> log("QUERY: Cell", self);
>>>> return self.data->toData()->asSequence()->at(2).oclAsType(String);
>>>> }
>>>>
>>>>
>>>> Any ideas to access the EFeatureMapEntry?
>>> Sounds like a question for the OCL or QVTo newsgroup. Maybe Ed
>>> Willink will see your question here.
>>>>
>>>> thanks, Christophe
Re: [OCL/QVTO] Accessing a EFeatureMapEntry [message #546974 is a reply to message #546901] Wed, 14 July 2010 19:21 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 51
Registered: August 2009
Member
This has been brought up before [1]. For now it looks like the only way is to implement your own QVTO black box function, something like:

@Operation(contextual = true)
public static Object getValue(FeatureMap.Entry self)
{
  return self.getValue();
}

[1] http://www.eclipse.org/forums/index.php?t=msg&goto=48620 8&#msg_486208

Alex
Re: [OCL/QVTO] Accessing a EFeatureMapEntry [message #547443 is a reply to message #546939] Fri, 16 July 2010 20:14 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi Ed,

Thank you. I managed to read out an EFeatureMap, using QVTO blackbox.
rgds Christophe

Ed Willink wrote:
> Hi Christophe
>
> The simple answer is no chance.
>
> The MDT/UML2 project has capabilities to convert advanced UML
> associations such as {subsets} to Ecore with special EAnnotations that
> genmodel recognises. Some of these are realised by EFeatureMap.
>
> The MDT/OCL project provides abilities to use OCL expressions on UML or
> Ecore meta-models, however I am not aware of any MDT/OCL functionality
> that is able to recognise the UML idiom in Ecore and so allow the UML
> syntax to be used in OCL. (It is just possible that this functionality
> may appear in MDT/OCL for Indigo.)
>
> In practice, EFeatureMap is just the type of an EAttribute so you may be
> able to use it as an EDataType. Or you may code custom Java helpers to
> perform useful actions on the EDataType.
>
> Regards
>
> Ed Willink
>
>
>
> On 14/07/2010 15:48, Ed Merks wrote:
>> Christophe,
>>
>> It's news://new.eclipse.org/eclipse.modeling.mdt.ocl I've added it to
>> the "to" list of the reply, so no need to repost.
>>
>>
>> Christophe Bouhier wrote:
>>> Ed,
>>>
>>> I posted this question first on the M2M group and then thought, it
>>> might be more of an OCL question. Sorry, not sure where OCL questions
>>> go?
>>>
>>> rgds Christophe
>>>
>>>
>>>> Christophe,
>>>>
>>>> Comments below.
>>>>
>>>>
>>>> Christophe Bouhier wrote:
>>>>> Hi,
>>>>>
>>>>> I am try to read the value of an EFeatureMapEntry.
>>>>>
>>>>>
>>>>> In the query below, I first query the type 'DataType1' which has a
>>>>> EFeatureMap and I request the first entry (using ->at(1)).
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> query XLS::DataType1::toData() : ECORE::EFeatureMapEntry {
>>>>> log("QUERY: Data", self.mixed->at(1));
>>>>> return self.mixed->at(1);
>>>>> }
>>>>>
>>>>> The log on this reports the following type: data:ecore.xml.type:text
>>>>>
>>>>>
>>>>> then, I use the result to get the value as a String.
>>>>> I try to convert to a Sequence
>>>> What's that?
>>>>> and get the second index which is
>>>>> supposed to be the value in the EFeatureMapEntry but this doesn't
>>>>> work.
>>>> Hmmm.
>>>>> It seems overcomplicated anyway.
>>>>>
>>>>> query XLS::CellType::toCell() : String {
>>>>> log("QUERY: Cell", self);
>>>>> return self.data->toData()->asSequence()->at(2).oclAsType(String);
>>>>> }
>>>>>
>>>>>
>>>>> Any ideas to access the EFeatureMapEntry?
>>>> Sounds like a question for the OCL or QVTo newsgroup. Maybe Ed
>>>> Willink will see your question here.
>>>>>
>>>>> thanks, Christophe
>
Previous Topic:EXTLibraryPackage ?
Next Topic:Problems with helper...
Goto Forum:
  


Current Time: Thu Apr 25 14:16:08 GMT 2024

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

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

Back to the top