Skip to main content



      Home
Home » Modeling » UML2 » Derived property getter in Static Profile
Derived property getter in Static Profile [message #477259] Wed, 16 April 2008 18:17 Go to next message
Eclipse UserFriend
After code generation for a static profile, getters for derived
properties contains this comment :

// The list is expected to implement
org.eclipse.emf.ecore.util.InternalEList and
org.eclipse.emf.ecore.EStructuralFeature.Setting
// so it's likely that an appropriate subclass of
org.eclipse.emf.ecore.util.EcoreEList should be used.

How should I implement such EcoreEList ?

regards,

Yann
Re: Derived property getter in Static Profile [message #477263 is a reply to message #477259] Thu, 17 April 2008 09:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi Yann,

Can you provide a few more details please:
1. What are the property settings in the UML model.
2. What are the genmodel settings.
3. What is the exact function being produced.
4. How will the property in question derive its value?

There might be something subtle that is being overlooked?

Cheers,
- James.

"Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
news:fu5tts$ad5$1@build.eclipse.org...
> After code generation for a static profile, getters for derived properties
> contains this comment :
>
> // The list is expected to implement
> org.eclipse.emf.ecore.util.InternalEList and
> org.eclipse.emf.ecore.EStructuralFeature.Setting
> // so it's likely that an appropriate subclass of
> org.eclipse.emf.ecore.util.EcoreEList should be used.
>
> How should I implement such EcoreEList ?
>
> regards,
>
> Yann
Re: Derived property getter in Static Profile [message #477264 is a reply to message #477263] Thu, 17 April 2008 12:05 Go to previous messageGo to next message
Eclipse UserFriend
The question concerns a UML profile for SysML.

In SysML the stereotype Requirement (extending Class) has two properties :
/ derived : Requirement [*] --> {public, isDerived = true}
/ derivedFrom : Requirement [*] --> {public, isDerived = true}

Requirements can be linked with DeriveReqt (a stereotype that inherits
from Standard::Trace).

The expected values for derived properties are defined in SysML spec:
• /derived:
Derived from all requirements that are the client of a «deriveReqt»
relationship for which this requirement is a supplier.
• /derivedFrom:
Derived from all requirements that are the supplier of a «deriveReqt»
relationship for which this requirement is a client.

The genmodel settings are default setting, except the fact that I
changed the "Base Package" namespace for model code generation.

The generated code is the following :

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Requirement> getDerived() {
// TODO: implement this method to return the 'Derived' reference list
// Ensure that you remove @generated or mark it @generated NOT
// The list is expected to implement
org.eclipse.emf.ecore.util.InternalEList and
org.eclipse.emf.ecore.EStructuralFeature.Setting
// so it's likely that an appropriate subclass of
org.eclipse.emf.ecore.util.EcoreEList should be used.
throw new UnsupportedOperationException();
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Requirement> getDerivedFrom() {
// TODO: implement this method to return the 'Derived From' reference list
// Ensure that you remove @generated or mark it @generated NOT
// The list is expected to implement
org.eclipse.emf.ecore.util.InternalEList and
org.eclipse.emf.ecore.EStructuralFeature.Setting
// so it's likely that an appropriate subclass of
org.eclipse.emf.ecore.util.EcoreEList should be used.
throw new UnsupportedOperationException();
}

I have implemented these getters, and the properties values are
correctly updated when I use the profile in my UML modeler.
The problem comes after saving/reopening the model, I get some
org.eclipse.emf.ecore.xmi.IllegalValueException.

In the getter implementation I return a BasicInternalEList<Requirement>,
which implements InternalEList but not EStructuralFeature.Setting.

That's why I am looking for a way to return some kind of EcoreEList
instead of BasicInternalEList.


James Bruck a écrit :
> Hi Yann,
>
> Can you provide a few more details please:
> 1. What are the property settings in the UML model.
> 2. What are the genmodel settings.
> 3. What is the exact function being produced.
> 4. How will the property in question derive its value?
>
> There might be something subtle that is being overlooked?
>
> Cheers,
> - James.
>
> "Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
> news:fu5tts$ad5$1@build.eclipse.org...
>> After code generation for a static profile, getters for derived properties
>> contains this comment :
>>
>> // The list is expected to implement
>> org.eclipse.emf.ecore.util.InternalEList and
>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>> // so it's likely that an appropriate subclass of
>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>
>> How should I implement such EcoreEList ?
>>
>> regards,
>>
>> Yann
>
>
Re: Derived property getter in Static Profile [message #477268 is a reply to message #477264] Fri, 18 April 2008 05:53 Go to previous messageGo to next message
Eclipse UserFriend
It appears that the exception I get during model opening is caused by a
null pointer in my getters.

The null pointer comes from "base_Class" or calls to
"base_Class_getClientDependencies()" returning null, maybe because the
getter is used while the model is not fully loaded ?



Yann Tanguy a écrit :
> The question concerns a UML profile for SysML.
>
> In SysML the stereotype Requirement (extending Class) has two properties :
> / derived : Requirement [*] --> {public, isDerived = true}
> / derivedFrom : Requirement [*] --> {public, isDerived = true}
>
> Requirements can be linked with DeriveReqt (a stereotype that inherits
> from Standard::Trace).
>
> The expected values for derived properties are defined in SysML spec:
> • /derived:
> Derived from all requirements that are the client of a «deriveReqt»
> relationship for which this requirement is a supplier.
> • /derivedFrom:
> Derived from all requirements that are the supplier of a «deriveReqt»
> relationship for which this requirement is a client.
>
> The genmodel settings are default setting, except the fact that I
> changed the "Base Package" namespace for model code generation.
>
> The generated code is the following :
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public EList<Requirement> getDerived() {
> // TODO: implement this method to return the 'Derived' reference list
> // Ensure that you remove @generated or mark it @generated NOT
> // The list is expected to implement
> org.eclipse.emf.ecore.util.InternalEList and
> org.eclipse.emf.ecore.EStructuralFeature.Setting
> // so it's likely that an appropriate subclass of
> org.eclipse.emf.ecore.util.EcoreEList should be used.
> throw new UnsupportedOperationException();
> }
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public EList<Requirement> getDerivedFrom() {
> // TODO: implement this method to return the 'Derived From'
> reference list
> // Ensure that you remove @generated or mark it @generated NOT
> // The list is expected to implement
> org.eclipse.emf.ecore.util.InternalEList and
> org.eclipse.emf.ecore.EStructuralFeature.Setting
> // so it's likely that an appropriate subclass of
> org.eclipse.emf.ecore.util.EcoreEList should be used.
> throw new UnsupportedOperationException();
> }
>
> I have implemented these getters, and the properties values are
> correctly updated when I use the profile in my UML modeler.
> The problem comes after saving/reopening the model, I get some
> org.eclipse.emf.ecore.xmi.IllegalValueException.
>
> In the getter implementation I return a BasicInternalEList<Requirement>,
> which implements InternalEList but not EStructuralFeature.Setting.
>
> That's why I am looking for a way to return some kind of EcoreEList
> instead of BasicInternalEList.
>
>
> James Bruck a écrit :
>> Hi Yann,
>>
>> Can you provide a few more details please:
>> 1. What are the property settings in the UML model.
>> 2. What are the genmodel settings.
>> 3. What is the exact function being produced.
>> 4. How will the property in question derive its value?
>>
>> There might be something subtle that is being overlooked?
>>
>> Cheers,
>> - James.
>>
>> "Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
>> news:fu5tts$ad5$1@build.eclipse.org...
>>> After code generation for a static profile, getters for derived
>>> properties contains this comment :
>>>
>>> // The list is expected to implement
>>> org.eclipse.emf.ecore.util.InternalEList and
>>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>>> // so it's likely that an appropriate subclass of
>>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>>
>>> How should I implement such EcoreEList ?
>>>
>>> regards,
>>>
>>> Yann
>>
>>
Re: Derived property getter in Static Profile [message #477276 is a reply to message #477259] Mon, 21 April 2008 13:10 Go to previous messageGo to next message
Eclipse UserFriend
Yann,

The org.eclipse.uml2.common plug-in provides a number of list
implementations that are useful when implementing derived features, most
notably DerivedEObjectEList and DerivedUnionEObjectEList. If you take a look
at how these lists (and their subclasses) are using in the UML2 API
implementation, you should be able to get a feel for how they might be
applicable in your code.

Kenn

"Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
news:fu5tts$ad5$1@build.eclipse.org...
> After code generation for a static profile, getters for derived properties
> contains this comment :
>
> // The list is expected to implement
> org.eclipse.emf.ecore.util.InternalEList and
> org.eclipse.emf.ecore.EStructuralFeature.Setting
> // so it's likely that an appropriate subclass of
> org.eclipse.emf.ecore.util.EcoreEList should be used.
>
> How should I implement such EcoreEList ?
>
> regards,
>
> Yann
Re: Derived property getter in Static Profile [message #477277 is a reply to message #477268] Mon, 21 April 2008 13:14 Go to previous messageGo to next message
Eclipse UserFriend
Yann,

Generally speaking, your derived features should not need to be computed
while a resource is being loaded... is this what is happening? Have you
ensure that your derived features are also transient (generally speaking,
they should be)?

Kenn

"Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
news:fu9r23$k0i$1@build.eclipse.org...
> It appears that the exception I get during model opening is caused by a
> null pointer in my getters.
>
> The null pointer comes from "base_Class" or calls to
> "base_Class_getClientDependencies()" returning null, maybe because the
> getter is used while the model is not fully loaded ?
>
>
>
> Yann Tanguy a
Re: Derived property getter in Static Profile [message #477278 is a reply to message #477277] Mon, 21 April 2008 18:53 Go to previous messageGo to next message
Eclipse UserFriend
Thanks a lot Kenn.

You were right the "transient" property was set to false.
Switching it to true solved my problem.

Maybe this should be done systematically by UML to ECORE converter for
derived properties ?

Yann.

Kenn Hussey a écrit :
> Yann,
>
> Generally speaking, your derived features should not need to be computed
> while a resource is being loaded... is this what is happening? Have you
> ensure that your derived features are also transient (generally speaking,
> they should be)?
>
> Kenn
>
> "Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
> news:fu9r23$k0i$1@build.eclipse.org...
>> It appears that the exception I get during model opening is caused by a
>> null pointer in my getters.
>>
>> The null pointer comes from "base_Class" or calls to
>> "base_Class_getClientDependencies()" returning null, maybe because the
>> getter is used while the model is not fully loaded ?
>>
>>
>>
>> Yann Tanguy a écrit :
>>> The question concerns a UML profile for SysML.
>>>
>>> In SysML the stereotype Requirement (extending Class) has two properties
>>> :
>>> / derived : Requirement [*] --> {public, isDerived = true}
>>> / derivedFrom : Requirement [*] --> {public, isDerived = true}
>>>
>>> Requirements can be linked with DeriveReqt (a stereotype that inherits
>>> from Standard::Trace).
>>>
>>> The expected values for derived properties are defined in SysML spec:
>>> • /derived:
>>> Derived from all requirements that are the client of a «deriveReqt»
>>> relationship for which this requirement is a supplier.
>>> • /derivedFrom:
>>> Derived from all requirements that are the supplier of a «deriveReqt»
>>> relationship for which this requirement is a client.
>>>
>>> The genmodel settings are default setting, except the fact that I changed
>>> the "Base Package" namespace for model code generation.
>>>
>>> The generated code is the following :
>>>
>>> /**
>>> * <!-- begin-user-doc -->
>>> * <!-- end-user-doc -->
>>> * @generated
>>> */
>>> public EList<Requirement> getDerived() {
>>> // TODO: implement this method to return the 'Derived' reference list
>>> // Ensure that you remove @generated or mark it @generated NOT
>>> // The list is expected to implement
>>> org.eclipse.emf.ecore.util.InternalEList and
>>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>>> // so it's likely that an appropriate subclass of
>>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>> throw new UnsupportedOperationException();
>>> }
>>>
>>> /**
>>> * <!-- begin-user-doc -->
>>> * <!-- end-user-doc -->
>>> * @generated
>>> */
>>> public EList<Requirement> getDerivedFrom() {
>>> // TODO: implement this method to return the 'Derived From' reference
>>> list
>>> // Ensure that you remove @generated or mark it @generated NOT
>>> // The list is expected to implement
>>> org.eclipse.emf.ecore.util.InternalEList and
>>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>>> // so it's likely that an appropriate subclass of
>>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>> throw new UnsupportedOperationException();
>>> }
>>>
>>> I have implemented these getters, and the properties values are correctly
>>> updated when I use the profile in my UML modeler.
>>> The problem comes after saving/reopening the model, I get some
>>> org.eclipse.emf.ecore.xmi.IllegalValueException.
>>>
>>> In the getter implementation I return a BasicInternalEList<Requirement>,
>>> which implements InternalEList but not EStructuralFeature.Setting.
>>>
>>> That's why I am looking for a way to return some kind of EcoreEList
>>> instead of BasicInternalEList.
>>>
>>>
>>> James Bruck a écrit :
>>>> Hi Yann,
>>>>
>>>> Can you provide a few more details please:
>>>> 1. What are the property settings in the UML model.
>>>> 2. What are the genmodel settings.
>>>> 3. What is the exact function being produced.
>>>> 4. How will the property in question derive its value?
>>>>
>>>> There might be something subtle that is being overlooked?
>>>>
>>>> Cheers,
>>>> - James.
>>>>
>>>> "Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
>>>> news:fu5tts$ad5$1@build.eclipse.org...
>>>>> After code generation for a static profile, getters for derived
>>>>> properties contains this comment :
>>>>>
>>>>> // The list is expected to implement
>>>>> org.eclipse.emf.ecore.util.InternalEList and
>>>>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>>>>> // so it's likely that an appropriate subclass of
>>>>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>>>>
>>>>> How should I implement such EcoreEList ?
>>>>>
>>>>> regards,
>>>>>
>>>>> Yann
>>>>
>
>
Re: Derived property getter in Static Profile [message #477279 is a reply to message #477278] Tue, 22 April 2008 08:37 Go to previous message
Eclipse UserFriend
Yann,

Not all derived properties are necessarily always transient, so the
converter doesn't make the assumption that they are...

Kenn

"Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
news:fuj5th$19m$1@build.eclipse.org...
> Thanks a lot Kenn.
>
> You were right the "transient" property was set to false.
> Switching it to true solved my problem.
>
> Maybe this should be done systematically by UML to ECORE converter for
> derived properties ?
>
> Yann.
>
> Kenn Hussey a
Re: Derived property getter in Static Profile [message #626420 is a reply to message #477259] Thu, 17 April 2008 09:17 Go to previous message
Eclipse UserFriend
Hi Yann,

Can you provide a few more details please:
1. What are the property settings in the UML model.
2. What are the genmodel settings.
3. What is the exact function being produced.
4. How will the property in question derive its value?

There might be something subtle that is being overlooked?

Cheers,
- James.

"Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
news:fu5tts$ad5$1@build.eclipse.org...
> After code generation for a static profile, getters for derived properties
> contains this comment :
>
> // The list is expected to implement
> org.eclipse.emf.ecore.util.InternalEList and
> org.eclipse.emf.ecore.EStructuralFeature.Setting
> // so it's likely that an appropriate subclass of
> org.eclipse.emf.ecore.util.EcoreEList should be used.
>
> How should I implement such EcoreEList ?
>
> regards,
>
> Yann
Re: Derived property getter in Static Profile [message #626421 is a reply to message #477263] Thu, 17 April 2008 12:05 Go to previous message
Eclipse UserFriend
The question concerns a UML profile for SysML.

In SysML the stereotype Requirement (extending Class) has two properties :
/ derived : Requirement [*] --> {public, isDerived = true}
/ derivedFrom : Requirement [*] --> {public, isDerived = true}

Requirements can be linked with DeriveReqt (a stereotype that inherits
from Standard::Trace).

The expected values for derived properties are defined in SysML spec:
• /derived:
Derived from all requirements that are the client of a «deriveReqt»
relationship for which this requirement is a supplier.
• /derivedFrom:
Derived from all requirements that are the supplier of a «deriveReqt»
relationship for which this requirement is a client.

The genmodel settings are default setting, except the fact that I
changed the "Base Package" namespace for model code generation.

The generated code is the following :

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Requirement> getDerived() {
// TODO: implement this method to return the 'Derived' reference list
// Ensure that you remove @generated or mark it @generated NOT
// The list is expected to implement
org.eclipse.emf.ecore.util.InternalEList and
org.eclipse.emf.ecore.EStructuralFeature.Setting
// so it's likely that an appropriate subclass of
org.eclipse.emf.ecore.util.EcoreEList should be used.
throw new UnsupportedOperationException();
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Requirement> getDerivedFrom() {
// TODO: implement this method to return the 'Derived From' reference list
// Ensure that you remove @generated or mark it @generated NOT
// The list is expected to implement
org.eclipse.emf.ecore.util.InternalEList and
org.eclipse.emf.ecore.EStructuralFeature.Setting
// so it's likely that an appropriate subclass of
org.eclipse.emf.ecore.util.EcoreEList should be used.
throw new UnsupportedOperationException();
}

I have implemented these getters, and the properties values are
correctly updated when I use the profile in my UML modeler.
The problem comes after saving/reopening the model, I get some
org.eclipse.emf.ecore.xmi.IllegalValueException.

In the getter implementation I return a BasicInternalEList<Requirement>,
which implements InternalEList but not EStructuralFeature.Setting.

That's why I am looking for a way to return some kind of EcoreEList
instead of BasicInternalEList.


James Bruck a écrit :
> Hi Yann,
>
> Can you provide a few more details please:
> 1. What are the property settings in the UML model.
> 2. What are the genmodel settings.
> 3. What is the exact function being produced.
> 4. How will the property in question derive its value?
>
> There might be something subtle that is being overlooked?
>
> Cheers,
> - James.
>
> "Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
> news:fu5tts$ad5$1@build.eclipse.org...
>> After code generation for a static profile, getters for derived properties
>> contains this comment :
>>
>> // The list is expected to implement
>> org.eclipse.emf.ecore.util.InternalEList and
>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>> // so it's likely that an appropriate subclass of
>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>
>> How should I implement such EcoreEList ?
>>
>> regards,
>>
>> Yann
>
>
Re: Derived property getter in Static Profile [message #626425 is a reply to message #477264] Fri, 18 April 2008 05:53 Go to previous message
Eclipse UserFriend
It appears that the exception I get during model opening is caused by a
null pointer in my getters.

The null pointer comes from "base_Class" or calls to
"base_Class_getClientDependencies()" returning null, maybe because the
getter is used while the model is not fully loaded ?



Yann Tanguy a écrit :
> The question concerns a UML profile for SysML.
>
> In SysML the stereotype Requirement (extending Class) has two properties :
> / derived : Requirement [*] --> {public, isDerived = true}
> / derivedFrom : Requirement [*] --> {public, isDerived = true}
>
> Requirements can be linked with DeriveReqt (a stereotype that inherits
> from Standard::Trace).
>
> The expected values for derived properties are defined in SysML spec:
> • /derived:
> Derived from all requirements that are the client of a «deriveReqt»
> relationship for which this requirement is a supplier.
> • /derivedFrom:
> Derived from all requirements that are the supplier of a «deriveReqt»
> relationship for which this requirement is a client.
>
> The genmodel settings are default setting, except the fact that I
> changed the "Base Package" namespace for model code generation.
>
> The generated code is the following :
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public EList<Requirement> getDerived() {
> // TODO: implement this method to return the 'Derived' reference list
> // Ensure that you remove @generated or mark it @generated NOT
> // The list is expected to implement
> org.eclipse.emf.ecore.util.InternalEList and
> org.eclipse.emf.ecore.EStructuralFeature.Setting
> // so it's likely that an appropriate subclass of
> org.eclipse.emf.ecore.util.EcoreEList should be used.
> throw new UnsupportedOperationException();
> }
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public EList<Requirement> getDerivedFrom() {
> // TODO: implement this method to return the 'Derived From'
> reference list
> // Ensure that you remove @generated or mark it @generated NOT
> // The list is expected to implement
> org.eclipse.emf.ecore.util.InternalEList and
> org.eclipse.emf.ecore.EStructuralFeature.Setting
> // so it's likely that an appropriate subclass of
> org.eclipse.emf.ecore.util.EcoreEList should be used.
> throw new UnsupportedOperationException();
> }
>
> I have implemented these getters, and the properties values are
> correctly updated when I use the profile in my UML modeler.
> The problem comes after saving/reopening the model, I get some
> org.eclipse.emf.ecore.xmi.IllegalValueException.
>
> In the getter implementation I return a BasicInternalEList<Requirement>,
> which implements InternalEList but not EStructuralFeature.Setting.
>
> That's why I am looking for a way to return some kind of EcoreEList
> instead of BasicInternalEList.
>
>
> James Bruck a écrit :
>> Hi Yann,
>>
>> Can you provide a few more details please:
>> 1. What are the property settings in the UML model.
>> 2. What are the genmodel settings.
>> 3. What is the exact function being produced.
>> 4. How will the property in question derive its value?
>>
>> There might be something subtle that is being overlooked?
>>
>> Cheers,
>> - James.
>>
>> "Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
>> news:fu5tts$ad5$1@build.eclipse.org...
>>> After code generation for a static profile, getters for derived
>>> properties contains this comment :
>>>
>>> // The list is expected to implement
>>> org.eclipse.emf.ecore.util.InternalEList and
>>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>>> // so it's likely that an appropriate subclass of
>>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>>
>>> How should I implement such EcoreEList ?
>>>
>>> regards,
>>>
>>> Yann
>>
>>
Re: Derived property getter in Static Profile [message #626434 is a reply to message #477259] Mon, 21 April 2008 13:10 Go to previous message
Eclipse UserFriend
Yann,

The org.eclipse.uml2.common plug-in provides a number of list
implementations that are useful when implementing derived features, most
notably DerivedEObjectEList and DerivedUnionEObjectEList. If you take a look
at how these lists (and their subclasses) are using in the UML2 API
implementation, you should be able to get a feel for how they might be
applicable in your code.

Kenn

"Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
news:fu5tts$ad5$1@build.eclipse.org...
> After code generation for a static profile, getters for derived properties
> contains this comment :
>
> // The list is expected to implement
> org.eclipse.emf.ecore.util.InternalEList and
> org.eclipse.emf.ecore.EStructuralFeature.Setting
> // so it's likely that an appropriate subclass of
> org.eclipse.emf.ecore.util.EcoreEList should be used.
>
> How should I implement such EcoreEList ?
>
> regards,
>
> Yann
Re: Derived property getter in Static Profile [message #626435 is a reply to message #477268] Mon, 21 April 2008 13:14 Go to previous message
Eclipse UserFriend
Yann,

Generally speaking, your derived features should not need to be computed
while a resource is being loaded... is this what is happening? Have you
ensure that your derived features are also transient (generally speaking,
they should be)?

Kenn

"Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
news:fu9r23$k0i$1@build.eclipse.org...
> It appears that the exception I get during model opening is caused by a
> null pointer in my getters.
>
> The null pointer comes from "base_Class" or calls to
> "base_Class_getClientDependencies()" returning null, maybe because the
> getter is used while the model is not fully loaded ?
>
>
>
> Yann Tanguy a
Re: Derived property getter in Static Profile [message #626436 is a reply to message #477277] Mon, 21 April 2008 18:53 Go to previous message
Eclipse UserFriend
Thanks a lot Kenn.

You were right the "transient" property was set to false.
Switching it to true solved my problem.

Maybe this should be done systematically by UML to ECORE converter for
derived properties ?

Yann.

Kenn Hussey a écrit :
> Yann,
>
> Generally speaking, your derived features should not need to be computed
> while a resource is being loaded... is this what is happening? Have you
> ensure that your derived features are also transient (generally speaking,
> they should be)?
>
> Kenn
>
> "Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
> news:fu9r23$k0i$1@build.eclipse.org...
>> It appears that the exception I get during model opening is caused by a
>> null pointer in my getters.
>>
>> The null pointer comes from "base_Class" or calls to
>> "base_Class_getClientDependencies()" returning null, maybe because the
>> getter is used while the model is not fully loaded ?
>>
>>
>>
>> Yann Tanguy a écrit :
>>> The question concerns a UML profile for SysML.
>>>
>>> In SysML the stereotype Requirement (extending Class) has two properties
>>> :
>>> / derived : Requirement [*] --> {public, isDerived = true}
>>> / derivedFrom : Requirement [*] --> {public, isDerived = true}
>>>
>>> Requirements can be linked with DeriveReqt (a stereotype that inherits
>>> from Standard::Trace).
>>>
>>> The expected values for derived properties are defined in SysML spec:
>>> • /derived:
>>> Derived from all requirements that are the client of a «deriveReqt»
>>> relationship for which this requirement is a supplier.
>>> • /derivedFrom:
>>> Derived from all requirements that are the supplier of a «deriveReqt»
>>> relationship for which this requirement is a client.
>>>
>>> The genmodel settings are default setting, except the fact that I changed
>>> the "Base Package" namespace for model code generation.
>>>
>>> The generated code is the following :
>>>
>>> /**
>>> * <!-- begin-user-doc -->
>>> * <!-- end-user-doc -->
>>> * @generated
>>> */
>>> public EList<Requirement> getDerived() {
>>> // TODO: implement this method to return the 'Derived' reference list
>>> // Ensure that you remove @generated or mark it @generated NOT
>>> // The list is expected to implement
>>> org.eclipse.emf.ecore.util.InternalEList and
>>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>>> // so it's likely that an appropriate subclass of
>>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>> throw new UnsupportedOperationException();
>>> }
>>>
>>> /**
>>> * <!-- begin-user-doc -->
>>> * <!-- end-user-doc -->
>>> * @generated
>>> */
>>> public EList<Requirement> getDerivedFrom() {
>>> // TODO: implement this method to return the 'Derived From' reference
>>> list
>>> // Ensure that you remove @generated or mark it @generated NOT
>>> // The list is expected to implement
>>> org.eclipse.emf.ecore.util.InternalEList and
>>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>>> // so it's likely that an appropriate subclass of
>>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>> throw new UnsupportedOperationException();
>>> }
>>>
>>> I have implemented these getters, and the properties values are correctly
>>> updated when I use the profile in my UML modeler.
>>> The problem comes after saving/reopening the model, I get some
>>> org.eclipse.emf.ecore.xmi.IllegalValueException.
>>>
>>> In the getter implementation I return a BasicInternalEList<Requirement>,
>>> which implements InternalEList but not EStructuralFeature.Setting.
>>>
>>> That's why I am looking for a way to return some kind of EcoreEList
>>> instead of BasicInternalEList.
>>>
>>>
>>> James Bruck a écrit :
>>>> Hi Yann,
>>>>
>>>> Can you provide a few more details please:
>>>> 1. What are the property settings in the UML model.
>>>> 2. What are the genmodel settings.
>>>> 3. What is the exact function being produced.
>>>> 4. How will the property in question derive its value?
>>>>
>>>> There might be something subtle that is being overlooked?
>>>>
>>>> Cheers,
>>>> - James.
>>>>
>>>> "Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
>>>> news:fu5tts$ad5$1@build.eclipse.org...
>>>>> After code generation for a static profile, getters for derived
>>>>> properties contains this comment :
>>>>>
>>>>> // The list is expected to implement
>>>>> org.eclipse.emf.ecore.util.InternalEList and
>>>>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>>>>> // so it's likely that an appropriate subclass of
>>>>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>>>>
>>>>> How should I implement such EcoreEList ?
>>>>>
>>>>> regards,
>>>>>
>>>>> Yann
>>>>
>
>
Re: Derived property getter in Static Profile [message #626437 is a reply to message #477278] Tue, 22 April 2008 08:37 Go to previous message
Eclipse UserFriend
Yann,

Not all derived properties are necessarily always transient, so the
converter doesn't make the assumption that they are...

Kenn

"Yann Tanguy" <yann.tanguy@cea.fr> wrote in message
news:fuj5th$19m$1@build.eclipse.org...
> Thanks a lot Kenn.
>
> You were right the "transient" property was set to false.
> Switching it to true solved my problem.
>
> Maybe this should be done systematically by UML to ECORE converter for
> derived properties ?
>
> Yann.
>
> Kenn Hussey a
Previous Topic:comptability with enterprise architect
Next Topic:how to modify an existing UML2 element using profile
Goto Forum:
  


Current Time: Sun Aug 31 16:22:43 EDT 2025

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

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

Back to the top