Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Can't set an attribute with an enumeration type
Can't set an attribute with an enumeration type [message #42766] Tue, 01 August 2006 12:59 Go to next message
Eclipse UserFriend
Originally posted by: contact.noelios.com

Hi all,

I'm using EMFT/OCL within GMF to initialize an attribute of type
PublisherType (enumeration). The ECore package name is "model".

Here is the ECore excerpt:
<eClassifiers xsi:type="ecore:EEnum" name="PublisherType">
<eLiterals name="Bean" value="1" literal="Bean"/>
<eLiterals name="File" value="2" literal="File"/>
<eLiterals name="HTTP" value="3" literal="HTTP"/>
<eLiterals name="JMS" value="4" literal="JMS"/>
<eLiterals name="SOAP" value="5" literal="SOAP"/>
<eLiterals name="TCP" value="6" literal="TCP"/>
</eClassifiers>

Here is the GMF Mapping excerpt:
<initializers
body="model::PublisherType::Bean">
<feature
xsi:type="ecore:EAttribute"
href="model.ecore#//Publisher/type"/>
</initializers>

I'm trying to use the following OCL expression but get an OCL parsing
error: "model::PublisherType::Bean" (without quotes)

And the GMF error message:
Diagnosis of
org.eclipse.gmf.mappings.impl.MappingImpl@35a891 {platform:/resource/com.supplyinsight.designer/model/rule.gm fmap#/}
Invalid expression body 'model::PublisherType::Bean'. Cause: Invalid
expression body 'model::PublisherType::Bean'. Cause:
org.eclipse.emf.ocl.parser.SemanticException: ERROR in
(enumerationOrClassLiteralExpCS): (Unknown type ([model, PublisherType,
Bean]))
Initialized 'Feature' must be owned by 'Domain Element' or its super type

Could someone help me fix my OCL expression?

Thanks,
--
Jerome Louvel
http://www.noelios.com
Re: Can't set an attribute with an enumeration type [message #42801 is a reply to message #42766] Tue, 01 August 2006 19:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Jerome,

Your OCL expression looks correct to me. You're simply trying to specify an
enumeration literal.

What does the code look like that GMF generates for initialization of the
"type" feature? Perhaps the context of the expression is not correct. I'm
not familiar with this usage of OCL in GMF. It may also be that the parser
cannot guess that this expression is intended to indicate an enumeration
literal (looks just like a reference to a type). A quotation of the
generated code should help to determine that.

Cheers,

Christian


Jerome Louvel wrote:

> Hi all,
>
> I'm using EMFT/OCL within GMF to initialize an attribute of type
> PublisherType (enumeration). The ECore package name is "model".
>
> Here is the ECore excerpt:
> <eClassifiers xsi:type="ecore:EEnum" name="PublisherType">
> <eLiterals name="Bean" value="1" literal="Bean"/>
> <eLiterals name="File" value="2" literal="File"/>
> <eLiterals name="HTTP" value="3" literal="HTTP"/>
> <eLiterals name="JMS" value="4" literal="JMS"/>
> <eLiterals name="SOAP" value="5" literal="SOAP"/>
> <eLiterals name="TCP" value="6" literal="TCP"/>
> </eClassifiers>
>
> Here is the GMF Mapping excerpt:
> <initializers
> body="model::PublisherType::Bean">
> <feature
> xsi:type="ecore:EAttribute"
> href="model.ecore#//Publisher/type"/>
> </initializers>
>
> I'm trying to use the following OCL expression but get an OCL parsing
> error: "model::PublisherType::Bean" (without quotes)
>
> And the GMF error message:
> Diagnosis of
>
org.eclipse.gmf.mappings.impl.MappingImpl@35a891 {platform:/resource/com.supplyinsight.designer/model/rule.gm fmap#/}
> Invalid expression body 'model::PublisherType::Bean'. Cause: Invalid
> expression body 'model::PublisherType::Bean'. Cause:
> org.eclipse.emf.ocl.parser.SemanticException: ERROR in
> (enumerationOrClassLiteralExpCS): (Unknown type ([model, PublisherType,
> Bean]))
> Initialized 'Feature' must be owned by 'Domain Element' or its super
> type
>
> Could someone help me fix my OCL expression?
>
> Thanks,
Re: Can't set an attribute with an enumeration type [message #42862 is a reply to message #42766] Tue, 01 August 2006 19:27 Go to previous messageGo to next message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
Hi Jerome,

Perhaps try not including the package, so just use 'PublisherType::Bean' in
the body.

Best,
Rich


On 8/1/06 8:59 AM, in article eanj7h$ib0$1@utils.eclipse.org, "Jerome
Louvel" <contact@noelios.com> wrote:

> Hi all,
>
> I'm using EMFT/OCL within GMF to initialize an attribute of type
> PublisherType (enumeration). The ECore package name is "model".
>
> Here is the ECore excerpt:
> <eClassifiers xsi:type="ecore:EEnum" name="PublisherType">
> <eLiterals name="Bean" value="1" literal="Bean"/>
> <eLiterals name="File" value="2" literal="File"/>
> <eLiterals name="HTTP" value="3" literal="HTTP"/>
> <eLiterals name="JMS" value="4" literal="JMS"/>
> <eLiterals name="SOAP" value="5" literal="SOAP"/>
> <eLiterals name="TCP" value="6" literal="TCP"/>
> </eClassifiers>
>
> Here is the GMF Mapping excerpt:
> <initializers
> body="model::PublisherType::Bean">
> <feature
> xsi:type="ecore:EAttribute"
> href="model.ecore#//Publisher/type"/>
> </initializers>
>
> I'm trying to use the following OCL expression but get an OCL parsing
> error: "model::PublisherType::Bean" (without quotes)
>
> And the GMF error message:
> Diagnosis of
> org.eclipse.gmf.mappings.impl.MappingImpl@35a891{platform:/resource/com.supply
> insight.designer/model/rule.gmfmap#/}
> Invalid expression body 'model::PublisherType::Bean'. Cause: Invalid
> expression body 'model::PublisherType::Bean'. Cause:
> org.eclipse.emf.ocl.parser.SemanticException: ERROR in
> (enumerationOrClassLiteralExpCS): (Unknown type ([model, PublisherType,
> Bean]))
> Initialized 'Feature' must be owned by 'Domain Element' or its super type
>
> Could someone help me fix my OCL expression?
>
> Thanks,
Re: Can't set an attribute with an enumeration type [message #42891 is a reply to message #42801] Tue, 01 August 2006 19:28 Go to previous messageGo to next message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
Hi Christian,

For feature initializers, a section in part 2 of the tutorial covers the GMF
functionality: http://wiki.eclipse.org/index.php/GMF_Tutorial_Part_2 and
includes a look (though possibly outdated) of what is generated.

Best,
Rich


On 8/1/06 3:15 PM, in article eao98e$niu$1@utils.eclipse.org, "Christian W.
Damus" <cdamus@ca.ibm.com> wrote:

>
> Hi, Jerome,
>
> Your OCL expression looks correct to me. You're simply trying to specify an
> enumeration literal.
>
> What does the code look like that GMF generates for initialization of the
> "type" feature? Perhaps the context of the expression is not correct. I'm
> not familiar with this usage of OCL in GMF. It may also be that the parser
> cannot guess that this expression is intended to indicate an enumeration
> literal (looks just like a reference to a type). A quotation of the
> generated code should help to determine that.
>
> Cheers,
>
> Christian
>
>
> Jerome Louvel wrote:
>
>> Hi all,
>>
>> I'm using EMFT/OCL within GMF to initialize an attribute of type
>> PublisherType (enumeration). The ECore package name is "model".
>>
>> Here is the ECore excerpt:
>> <eClassifiers xsi:type="ecore:EEnum" name="PublisherType">
>> <eLiterals name="Bean" value="1" literal="Bean"/>
>> <eLiterals name="File" value="2" literal="File"/>
>> <eLiterals name="HTTP" value="3" literal="HTTP"/>
>> <eLiterals name="JMS" value="4" literal="JMS"/>
>> <eLiterals name="SOAP" value="5" literal="SOAP"/>
>> <eLiterals name="TCP" value="6" literal="TCP"/>
>> </eClassifiers>
>>
>> Here is the GMF Mapping excerpt:
>> <initializers
>> body="model::PublisherType::Bean">
>> <feature
>> xsi:type="ecore:EAttribute"
>> href="model.ecore#//Publisher/type"/>
>> </initializers>
>>
>> I'm trying to use the following OCL expression but get an OCL parsing
>> error: "model::PublisherType::Bean" (without quotes)
>>
>> And the GMF error message:
>> Diagnosis of
>>
> org.eclipse.gmf.mappings.impl.MappingImpl@35a891{platform:/resource/com.supply
> insight.designer/model/rule.gmfmap#/}
>> Invalid expression body 'model::PublisherType::Bean'. Cause: Invalid
>> expression body 'model::PublisherType::Bean'. Cause:
>> org.eclipse.emf.ocl.parser.SemanticException: ERROR in
>> (enumerationOrClassLiteralExpCS): (Unknown type ([model, PublisherType,
>> Bean]))
>> Initialized 'Feature' must be owned by 'Domain Element' or its super
>> type
>>
>> Could someone help me fix my OCL expression?
>>
>> Thanks,
>
Re: Can't set an attribute with an enumeration type [message #42953 is a reply to message #42862] Tue, 01 August 2006 19:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Good idea, Rich. I hope that isn't the problem! The qualification by
package should work, although it is subject to problems where multiple
registered packages have the same name.

cW

Richard Gronback wrote:

> Hi Jerome,
>
> Perhaps try not including the package, so just use 'PublisherType::Bean'
> in the body.
>
> Best,
> Rich
>
>
> On 8/1/06 8:59 AM, in article eanj7h$ib0$1@utils.eclipse.org, "Jerome
> Louvel" <contact@noelios.com> wrote:
>

<snip>
Re: Can't set an attribute with an enumeration type [message #42983 is a reply to message #42953] Tue, 01 August 2006 19:32 Go to previous messageGo to next message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
I agree... And expect to find a new Bugzilla if indeed it does work without
the package ;)

Best,
Rich


On 8/1/06 3:32 PM, in article eaoa7u$niu$4@utils.eclipse.org, "Christian W.
Damus" <cdamus@ca.ibm.com> wrote:

>
> Good idea, Rich. I hope that isn't the problem! The qualification by
> package should work, although it is subject to problems where multiple
> registered packages have the same name.
>
> cW
>
> Richard Gronback wrote:
>
>> Hi Jerome,
>>
>> Perhaps try not including the package, so just use 'PublisherType::Bean'
>> in the body.
>>
>> Best,
>> Rich
>>
>>
>> On 8/1/06 8:59 AM, in article eanj7h$ib0$1@utils.eclipse.org, "Jerome
>> Louvel" <contact@noelios.com> wrote:
>>
>
> <snip>
Re: Can't set an attribute with an enumeration type [message #43014 is a reply to message #42891] Tue, 01 August 2006 19:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Thanks, Rich, for the pointer. Nice tutorial.

Doesn't look like the problem is in that code, to me. I suspect you're
right about the package name.

cW


Richard Gronback wrote:

> Hi Christian,
>
> For feature initializers, a section in part 2 of the tutorial covers the
> GMF functionality: http://wiki.eclipse.org/index.php/GMF_Tutorial_Part_2
> and includes a look (though possibly outdated) of what is generated.
>
> Best,
> Rich
>
Re: Can't set an attribute with an enumeration type [message #43088 is a reply to message #42766] Wed, 02 August 2006 00:00 Go to previous messageGo to next message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi Jerome,

as already mentioned in the other posts your OCL expression looks correct.
The problem is most likely caused by failure of enumerationLiteral's package
lookup through the global package
registry (used as default, see org.eclipse.emf.ocl.parser.EcoreEnvironment).
This can happen if
1) your model code is not generated and package not registered using
'org.eclipse.emf.ecore.generated_package'
extension point which populates the package registry.

2) GMF should ensure that used domain model packages are forced to be
initialized in the global EPackage.Registry by
simply accessing the package instance there. It is necessary to make it
visible for OCL env lookup (which skips EPackage.Descriptor entries).
During GMF mappings validation, packages of all referenced domain metamodel
elements get initialized as described.
Your error messages come from validation and I can see yet another message:
'Initialized 'Feature' must be owned by 'Domain Element' or its super type'
indicating that no domain element is selected or it does not contain the
initialized feature.
Check if your mapping model specifies domain metamodel at all or the
enumeration is not from a different one.

All further details are rather GMF specific so we should continue at
'eclipse.modeling.gmf'.

Regards,
/Radek


"Jerome Louvel" <contact@noelios.com> wrote in message
news:eanj7h$ib0$1@utils.eclipse.org...
> Hi all,
>
> I'm using EMFT/OCL within GMF to initialize an attribute of type
> PublisherType (enumeration). The ECore package name is "model".
>
> Here is the ECore excerpt:
> <eClassifiers xsi:type="ecore:EEnum" name="PublisherType">
> <eLiterals name="Bean" value="1" literal="Bean"/>
> <eLiterals name="File" value="2" literal="File"/>
> <eLiterals name="HTTP" value="3" literal="HTTP"/>
> <eLiterals name="JMS" value="4" literal="JMS"/>
> <eLiterals name="SOAP" value="5" literal="SOAP"/>
> <eLiterals name="TCP" value="6" literal="TCP"/>
> </eClassifiers>
>
> Here is the GMF Mapping excerpt:
> <initializers
> body="model::PublisherType::Bean">
> <feature
> xsi:type="ecore:EAttribute"
> href="model.ecore#//Publisher/type"/>
> </initializers>
>
> I'm trying to use the following OCL expression but get an OCL parsing
> error: "model::PublisherType::Bean" (without quotes)
>
> And the GMF error message:
> Diagnosis of
> org.eclipse.gmf.mappings.impl.MappingImpl@35a891 {platform:/resource/com.supplyinsight.designer/model/rule.gm fmap#/}
> Invalid expression body 'model::PublisherType::Bean'. Cause: Invalid
> expression body 'model::PublisherType::Bean'. Cause:
> org.eclipse.emf.ocl.parser.SemanticException: ERROR in
> (enumerationOrClassLiteralExpCS): (Unknown type ([model, PublisherType,
> Bean]))
> Initialized 'Feature' must be owned by 'Domain Element' or its super
> type
>
> Could someone help me fix my OCL expression?
>
> Thanks,
> --
> Jerome Louvel
> http://www.noelios.com
Re: Can't set an attribute with an enumeration type [message #43108 is a reply to message #42983] Wed, 02 August 2006 08:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: contact.noelios.com

Hi Christian and Rich,

I've tried removing the package name from my OCL expression, and it
indeed works!

<initializers
body="PublisherType::Bean">
<feature
xsi:type="ecore:EAttribute"
href="model.ecore#//Publisher/type"/>
</initializers>


FYI, I'm only using one EMF model in this application. Here is an
excerpt of the generated EMF package:

public interface DesignerPackage extends EPackage
{
[...]
String eNAME = "model";
String eNS_URI = "http://www.supplyinsight.com/designer/model";
String eNS_PREFIX = "designer";
[...]
}


I've entered a related bug report at:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=152563

Thanks,
Jerome
Re: Can't set an attribute with an enumeration type [message #43139 is a reply to message #43088] Wed, 02 August 2006 08:17 Go to previous message
Eclipse UserFriend
Originally posted by: contact.noelios.com

Hi Radek,

You wrote :
> as already mentioned in the other posts your OCL expression looks correct.
> The problem is most likely caused by failure of enumerationLiteral's package
> lookup through the global package
> registry (used as default, see org.eclipse.emf.ocl.parser.EcoreEnvironment).
> This can happen if

> 1) your model code is not generated and package not registered using
> 'org.eclipse.emf.ecore.generated_package'
> extension point which populates the package registry.

This was not the case, my EMF model was generated and working fine
before setting the OCL expression. In my model plugin, I do have:

<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "http://www.supplyinsight.com/designer/model"
class = "com.supplyinsight.designer.model.DesignerPackage" />
</extension>


> 2) GMF should ensure that used domain model packages are forced to be
> initialized in the global EPackage.Registry by
> simply accessing the package instance there. It is necessary to make it
> visible for OCL env lookup (which skips EPackage.Descriptor entries).
> During GMF mappings validation, packages of all referenced domain metamodel
> elements get initialized as described.
I'm not sure to follow you in the details, but I understand that it may
be an issue with the package registration in order to make it accessible
by OCL.

> Your error messages come from validation and I can see yet another message:
> 'Initialized 'Feature' must be owned by 'Domain Element' or its super type'
> indicating that no domain element is selected or it does not contain the
> initialized feature.
Correct, this was another unrelated issue that I fixed right after.

> Check if your mapping model specifies domain metamodel at all or the
> enumeration is not from a different one.
As it works without the package name, I assume that my mapping model is
correct, let me know if you still need to check this detail.

> All further details are rather GMF specific so we should continue at
> 'eclipse.modeling.gmf'.

I've entered the bug report in EMFT/OCL for now, let's see if it moves
somewhere else :-)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=152563

Thanks,
Jerome Louvel
http://www.noelios.com
Re: Can't set an attribute with an enumeration type [message #584117 is a reply to message #42766] Tue, 01 August 2006 19:15 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Jerome,

Your OCL expression looks correct to me. You're simply trying to specify an
enumeration literal.

What does the code look like that GMF generates for initialization of the
"type" feature? Perhaps the context of the expression is not correct. I'm
not familiar with this usage of OCL in GMF. It may also be that the parser
cannot guess that this expression is intended to indicate an enumeration
literal (looks just like a reference to a type). A quotation of the
generated code should help to determine that.

Cheers,

Christian


Jerome Louvel wrote:

> Hi all,
>
> I'm using EMFT/OCL within GMF to initialize an attribute of type
> PublisherType (enumeration). The ECore package name is "model".
>
> Here is the ECore excerpt:
> <eClassifiers xsi:type="ecore:EEnum" name="PublisherType">
> <eLiterals name="Bean" value="1" literal="Bean"/>
> <eLiterals name="File" value="2" literal="File"/>
> <eLiterals name="HTTP" value="3" literal="HTTP"/>
> <eLiterals name="JMS" value="4" literal="JMS"/>
> <eLiterals name="SOAP" value="5" literal="SOAP"/>
> <eLiterals name="TCP" value="6" literal="TCP"/>
> </eClassifiers>
>
> Here is the GMF Mapping excerpt:
> <initializers
> body="model::PublisherType::Bean">
> <feature
> xsi:type="ecore:EAttribute"
> href="model.ecore#//Publisher/type"/>
> </initializers>
>
> I'm trying to use the following OCL expression but get an OCL parsing
> error: "model::PublisherType::Bean" (without quotes)
>
> And the GMF error message:
> Diagnosis of
>
org.eclipse.gmf.mappings.impl.MappingImpl@35a891 {platform:/resource/com.supplyinsight.designer/model/rule.gm fmap#/}
> Invalid expression body 'model::PublisherType::Bean'. Cause: Invalid
> expression body 'model::PublisherType::Bean'. Cause:
> org.eclipse.emf.ocl.parser.SemanticException: ERROR in
> (enumerationOrClassLiteralExpCS): (Unknown type ([model, PublisherType,
> Bean]))
> Initialized 'Feature' must be owned by 'Domain Element' or its super
> type
>
> Could someone help me fix my OCL expression?
>
> Thanks,
Re: Can't set an attribute with an enumeration type [message #584141 is a reply to message #42766] Tue, 01 August 2006 19:27 Go to previous message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
Hi Jerome,

Perhaps try not including the package, so just use 'PublisherType::Bean' in
the body.

Best,
Rich


On 8/1/06 8:59 AM, in article eanj7h$ib0$1@utils.eclipse.org, "Jerome
Louvel" <contact@noelios.com> wrote:

> Hi all,
>
> I'm using EMFT/OCL within GMF to initialize an attribute of type
> PublisherType (enumeration). The ECore package name is "model".
>
> Here is the ECore excerpt:
> <eClassifiers xsi:type="ecore:EEnum" name="PublisherType">
> <eLiterals name="Bean" value="1" literal="Bean"/>
> <eLiterals name="File" value="2" literal="File"/>
> <eLiterals name="HTTP" value="3" literal="HTTP"/>
> <eLiterals name="JMS" value="4" literal="JMS"/>
> <eLiterals name="SOAP" value="5" literal="SOAP"/>
> <eLiterals name="TCP" value="6" literal="TCP"/>
> </eClassifiers>
>
> Here is the GMF Mapping excerpt:
> <initializers
> body="model::PublisherType::Bean">
> <feature
> xsi:type="ecore:EAttribute"
> href="model.ecore#//Publisher/type"/>
> </initializers>
>
> I'm trying to use the following OCL expression but get an OCL parsing
> error: "model::PublisherType::Bean" (without quotes)
>
> And the GMF error message:
> Diagnosis of
> org.eclipse.gmf.mappings.impl.MappingImpl@35a891{platform:/resource/com.supply
> insight.designer/model/rule.gmfmap#/}
> Invalid expression body 'model::PublisherType::Bean'. Cause: Invalid
> expression body 'model::PublisherType::Bean'. Cause:
> org.eclipse.emf.ocl.parser.SemanticException: ERROR in
> (enumerationOrClassLiteralExpCS): (Unknown type ([model, PublisherType,
> Bean]))
> Initialized 'Feature' must be owned by 'Domain Element' or its super type
>
> Could someone help me fix my OCL expression?
>
> Thanks,
Re: Can't set an attribute with an enumeration type [message #584161 is a reply to message #42801] Tue, 01 August 2006 19:28 Go to previous message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
Hi Christian,

For feature initializers, a section in part 2 of the tutorial covers the GMF
functionality: http://wiki.eclipse.org/index.php/GMF_Tutorial_Part_2 and
includes a look (though possibly outdated) of what is generated.

Best,
Rich


On 8/1/06 3:15 PM, in article eao98e$niu$1@utils.eclipse.org, "Christian W.
Damus" <cdamus@ca.ibm.com> wrote:

>
> Hi, Jerome,
>
> Your OCL expression looks correct to me. You're simply trying to specify an
> enumeration literal.
>
> What does the code look like that GMF generates for initialization of the
> "type" feature? Perhaps the context of the expression is not correct. I'm
> not familiar with this usage of OCL in GMF. It may also be that the parser
> cannot guess that this expression is intended to indicate an enumeration
> literal (looks just like a reference to a type). A quotation of the
> generated code should help to determine that.
>
> Cheers,
>
> Christian
>
>
> Jerome Louvel wrote:
>
>> Hi all,
>>
>> I'm using EMFT/OCL within GMF to initialize an attribute of type
>> PublisherType (enumeration). The ECore package name is "model".
>>
>> Here is the ECore excerpt:
>> <eClassifiers xsi:type="ecore:EEnum" name="PublisherType">
>> <eLiterals name="Bean" value="1" literal="Bean"/>
>> <eLiterals name="File" value="2" literal="File"/>
>> <eLiterals name="HTTP" value="3" literal="HTTP"/>
>> <eLiterals name="JMS" value="4" literal="JMS"/>
>> <eLiterals name="SOAP" value="5" literal="SOAP"/>
>> <eLiterals name="TCP" value="6" literal="TCP"/>
>> </eClassifiers>
>>
>> Here is the GMF Mapping excerpt:
>> <initializers
>> body="model::PublisherType::Bean">
>> <feature
>> xsi:type="ecore:EAttribute"
>> href="model.ecore#//Publisher/type"/>
>> </initializers>
>>
>> I'm trying to use the following OCL expression but get an OCL parsing
>> error: "model::PublisherType::Bean" (without quotes)
>>
>> And the GMF error message:
>> Diagnosis of
>>
> org.eclipse.gmf.mappings.impl.MappingImpl@35a891{platform:/resource/com.supply
> insight.designer/model/rule.gmfmap#/}
>> Invalid expression body 'model::PublisherType::Bean'. Cause: Invalid
>> expression body 'model::PublisherType::Bean'. Cause:
>> org.eclipse.emf.ocl.parser.SemanticException: ERROR in
>> (enumerationOrClassLiteralExpCS): (Unknown type ([model, PublisherType,
>> Bean]))
>> Initialized 'Feature' must be owned by 'Domain Element' or its super
>> type
>>
>> Could someone help me fix my OCL expression?
>>
>> Thanks,
>
Re: Can't set an attribute with an enumeration type [message #584192 is a reply to message #42862] Tue, 01 August 2006 19:32 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Good idea, Rich. I hope that isn't the problem! The qualification by
package should work, although it is subject to problems where multiple
registered packages have the same name.

cW

Richard Gronback wrote:

> Hi Jerome,
>
> Perhaps try not including the package, so just use 'PublisherType::Bean'
> in the body.
>
> Best,
> Rich
>
>
> On 8/1/06 8:59 AM, in article eanj7h$ib0$1@utils.eclipse.org, "Jerome
> Louvel" <contact@noelios.com> wrote:
>

<snip>
Re: Can't set an attribute with an enumeration type [message #584201 is a reply to message #42953] Tue, 01 August 2006 19:32 Go to previous message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
I agree... And expect to find a new Bugzilla if indeed it does work without
the package ;)

Best,
Rich


On 8/1/06 3:32 PM, in article eaoa7u$niu$4@utils.eclipse.org, "Christian W.
Damus" <cdamus@ca.ibm.com> wrote:

>
> Good idea, Rich. I hope that isn't the problem! The qualification by
> package should work, although it is subject to problems where multiple
> registered packages have the same name.
>
> cW
>
> Richard Gronback wrote:
>
>> Hi Jerome,
>>
>> Perhaps try not including the package, so just use 'PublisherType::Bean'
>> in the body.
>>
>> Best,
>> Rich
>>
>>
>> On 8/1/06 8:59 AM, in article eanj7h$ib0$1@utils.eclipse.org, "Jerome
>> Louvel" <contact@noelios.com> wrote:
>>
>
> <snip>
Re: Can't set an attribute with an enumeration type [message #584216 is a reply to message #42891] Tue, 01 August 2006 19:35 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Thanks, Rich, for the pointer. Nice tutorial.

Doesn't look like the problem is in that code, to me. I suspect you're
right about the package name.

cW


Richard Gronback wrote:

> Hi Christian,
>
> For feature initializers, a section in part 2 of the tutorial covers the
> GMF functionality: http://wiki.eclipse.org/index.php/GMF_Tutorial_Part_2
> and includes a look (though possibly outdated) of what is generated.
>
> Best,
> Rich
>
Re: Can't set an attribute with an enumeration type [message #584237 is a reply to message #42766] Wed, 02 August 2006 00:00 Go to previous message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi Jerome,

as already mentioned in the other posts your OCL expression looks correct.
The problem is most likely caused by failure of enumerationLiteral's package
lookup through the global package
registry (used as default, see org.eclipse.emf.ocl.parser.EcoreEnvironment).
This can happen if
1) your model code is not generated and package not registered using
'org.eclipse.emf.ecore.generated_package'
extension point which populates the package registry.

2) GMF should ensure that used domain model packages are forced to be
initialized in the global EPackage.Registry by
simply accessing the package instance there. It is necessary to make it
visible for OCL env lookup (which skips EPackage.Descriptor entries).
During GMF mappings validation, packages of all referenced domain metamodel
elements get initialized as described.
Your error messages come from validation and I can see yet another message:
'Initialized 'Feature' must be owned by 'Domain Element' or its super type'
indicating that no domain element is selected or it does not contain the
initialized feature.
Check if your mapping model specifies domain metamodel at all or the
enumeration is not from a different one.

All further details are rather GMF specific so we should continue at
'eclipse.modeling.gmf'.

Regards,
/Radek


"Jerome Louvel" <contact@noelios.com> wrote in message
news:eanj7h$ib0$1@utils.eclipse.org...
> Hi all,
>
> I'm using EMFT/OCL within GMF to initialize an attribute of type
> PublisherType (enumeration). The ECore package name is "model".
>
> Here is the ECore excerpt:
> <eClassifiers xsi:type="ecore:EEnum" name="PublisherType">
> <eLiterals name="Bean" value="1" literal="Bean"/>
> <eLiterals name="File" value="2" literal="File"/>
> <eLiterals name="HTTP" value="3" literal="HTTP"/>
> <eLiterals name="JMS" value="4" literal="JMS"/>
> <eLiterals name="SOAP" value="5" literal="SOAP"/>
> <eLiterals name="TCP" value="6" literal="TCP"/>
> </eClassifiers>
>
> Here is the GMF Mapping excerpt:
> <initializers
> body="model::PublisherType::Bean">
> <feature
> xsi:type="ecore:EAttribute"
> href="model.ecore#//Publisher/type"/>
> </initializers>
>
> I'm trying to use the following OCL expression but get an OCL parsing
> error: "model::PublisherType::Bean" (without quotes)
>
> And the GMF error message:
> Diagnosis of
> org.eclipse.gmf.mappings.impl.MappingImpl@35a891 {platform:/resource/com.supplyinsight.designer/model/rule.gm fmap#/}
> Invalid expression body 'model::PublisherType::Bean'. Cause: Invalid
> expression body 'model::PublisherType::Bean'. Cause:
> org.eclipse.emf.ocl.parser.SemanticException: ERROR in
> (enumerationOrClassLiteralExpCS): (Unknown type ([model, PublisherType,
> Bean]))
> Initialized 'Feature' must be owned by 'Domain Element' or its super
> type
>
> Could someone help me fix my OCL expression?
>
> Thanks,
> --
> Jerome Louvel
> http://www.noelios.com
Re: Can't set an attribute with an enumeration type [message #584254 is a reply to message #42983] Wed, 02 August 2006 08:06 Go to previous message
Jerome Louvel is currently offline Jerome LouvelFriend
Messages: 14
Registered: July 2009
Junior Member
Hi Christian and Rich,

I've tried removing the package name from my OCL expression, and it
indeed works!

<initializers
body="PublisherType::Bean">
<feature
xsi:type="ecore:EAttribute"
href="model.ecore#//Publisher/type"/>
</initializers>


FYI, I'm only using one EMF model in this application. Here is an
excerpt of the generated EMF package:

public interface DesignerPackage extends EPackage
{
[...]
String eNAME = "model";
String eNS_URI = "http://www.supplyinsight.com/designer/model";
String eNS_PREFIX = "designer";
[...]
}


I've entered a related bug report at:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=152563

Thanks,
Jerome
Re: Can't set an attribute with an enumeration type [message #584270 is a reply to message #43088] Wed, 02 August 2006 08:17 Go to previous message
Jerome Louvel is currently offline Jerome LouvelFriend
Messages: 14
Registered: July 2009
Junior Member
Hi Radek,

You wrote :
> as already mentioned in the other posts your OCL expression looks correct.
> The problem is most likely caused by failure of enumerationLiteral's package
> lookup through the global package
> registry (used as default, see org.eclipse.emf.ocl.parser.EcoreEnvironment).
> This can happen if

> 1) your model code is not generated and package not registered using
> 'org.eclipse.emf.ecore.generated_package'
> extension point which populates the package registry.

This was not the case, my EMF model was generated and working fine
before setting the OCL expression. In my model plugin, I do have:

<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "http://www.supplyinsight.com/designer/model"
class = "com.supplyinsight.designer.model.DesignerPackage" />
</extension>


> 2) GMF should ensure that used domain model packages are forced to be
> initialized in the global EPackage.Registry by
> simply accessing the package instance there. It is necessary to make it
> visible for OCL env lookup (which skips EPackage.Descriptor entries).
> During GMF mappings validation, packages of all referenced domain metamodel
> elements get initialized as described.
I'm not sure to follow you in the details, but I understand that it may
be an issue with the package registration in order to make it accessible
by OCL.

> Your error messages come from validation and I can see yet another message:
> 'Initialized 'Feature' must be owned by 'Domain Element' or its super type'
> indicating that no domain element is selected or it does not contain the
> initialized feature.
Correct, this was another unrelated issue that I fixed right after.

> Check if your mapping model specifies domain metamodel at all or the
> enumeration is not from a different one.
As it works without the package name, I assume that my mapping model is
correct, let me know if you still need to check this detail.

> All further details are rather GMF specific so we should continue at
> 'eclipse.modeling.gmf'.

I've entered the bug report in EMFT/OCL for now, let's see if it moves
somewhere else :-)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=152563

Thanks,
Jerome Louvel
http://www.noelios.com
Previous Topic:OclInvalid and Collections
Next Topic:CDO ResourceManager lifecycle
Goto Forum:
  


Current Time: Fri Apr 26 19:34:44 GMT 2024

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

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

Back to the top