Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Querying properties that are EFeatureMapEntry Objects(How Do I query object properties that are of EFeatureMapEntry?)
Querying properties that are EFeatureMapEntry Objects [message #692715] Tue, 05 July 2011 01:25 Go to next message
Mark Sluser is currently offline Mark Sluser
Messages: 15
Registered: June 2011
Location: Calgary
Junior Member
I have an ecore metamodel I created from an XML Schema. I have generated an editor and I created a model.

When I launch the XText OCL Console, I can issue queries against model properties that are of type EString, however when I issue a query against an property that is of type EFeatureMapEntry, or a property that is grouped with a property that is a EFeatureMapEntry (as is quite common in XML Schemas) I get the following:


Evaluating:
self.paramValue
Results:
Parsing failure
null
Unresolved property 'paramValue' for 'OclInvalid'


What am I doing wrong?

I am using the Indigo-Modeling release of Eclipse.

Thank you

-Mark
Calgary, AB
Re: Querying properties that are EFeatureMapEntry Objects [message #692746 is a reply to message #692715] Tue, 05 July 2011 02:43 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4014
Registered: July 2009
Senior Member
Hi Mark

The current Xtext-based OCL support is for EMOF (Ecore) with some UML
functionality.

EFeatureMapEntry have no EMOF counterpart, they are part of Ecore's
support for UML-like qualified associations.
You should thereforee be using some form of "property[another-property]"
syntax, which might get you past the
parser, but it certainly won't evaluate.

If you'd like to file a Bugzilla with a simple model, it will motivate
me to tackle qualified associations. We're planning
a further release before Juno; This irritates me sufficiently to try to
tackle it before Juno.

I'm afraid that doesn't help you today.

Regards

Ed Willink


On 05/07/2011 06:25, Mark Sluser wrote:
> I have an ecore metamodel I created from an XML Schema. I have
> generated an editor and I created a model.
>
> When I launch the XText OCL Console, I can issue queries against model
> properties that are of type EString, however when I issue a query
> against an property that is of type EFeatureMapEntry, or a property
> that is grouped with a property that is a EFeatureMapEntry (as is
> quite common in XML Schemas) I get the following:
>
>
> Evaluating:
> self.paramValue
> Results:
> Parsing failure
> null
> Unresolved property 'paramValue' for 'OclInvalid'
>
>
> What am I doing wrong?
>
> I am using the Indigo-Modeling release of Eclipse.
>
> Thank you
>
> -Mark
> Calgary, AB
>
Re: Querying properties that are EFeatureMapEntry Objects [message #693236 is a reply to message #692746] Wed, 06 July 2011 01:07 Go to previous messageGo to next message
Mark Sluser is currently offline Mark Sluser
Messages: 15
Registered: June 2011
Location: Calgary
Junior Member
First, thanks for replying Ed. It is great to see you responding so quickly in the user forum.

I believe I found a work-around to my problem, which is not to use feature maps.
I was given a XDR (the old Microsoft xml schema) file to begin with and it describes the following elements

<ElementType name="BlockDef" content="eltOnly" model="closed" order="many">
<element type="BlockName" maxOccurs="1"/>
<element type="EntityName" minOccurs="0" maxOccurs="1"/>
<element type="BlockId" minOccurs="0" maxOccurs="1"/>
<element type="BlockGUID" minOccurs="0" maxOccurs="1"/>
<element type="BlockDesc" minOccurs="0" maxOccurs="*"/>
<element type="TemplateName" maxOccurs="1"/>
<element type="ClassName" minOccurs="0" maxOccurs="1"/>
<element type="BaseTemplateName" minOccurs="0" maxOccurs="1"/>
<element type="Attribute" minOccurs="0" maxOccurs="1"/>
<element type="CreateType" minOccurs="0" maxOccurs="1"/>
<element type="BlockDoc" minOccurs="0" maxOccurs="1"/>
<element type="HandlerName" minOccurs="0" maxOccurs="1"/>
<element type="Coord" minOccurs="0" maxOccurs="1"/>
<element type="LifeCycleState" maxOccurs="1"/>
<element type="CeeName" minOccurs="0" maxOccurs="1"/>
<element type="AssignedTo" minOccurs="0" maxOccurs="1"/>
<element type="Container" minOccurs="0" maxOccurs="1"/>
<element type="HwDetail" minOccurs="0" maxOccurs="1"/>
<element type="SnlDataInfo" minOccurs="0" maxOccurs="*"/>
<element type="Reference" minOccurs="0" maxOccurs="*"/>
</ElementType>

<ElementType name="Block" content="eltOnly" model="closed" order="many">
<element type="BlockDef" maxOccurs="1"/>
<element type="Parameters" minOccurs="0" maxOccurs="1"/>
<element type="ProjParameters" minOccurs="0" maxOccurs="1"/>
<element type="SymbolAttrs" minOccurs="0" maxOccurs="1"/>
<element type="Connections" minOccurs="0" maxOccurs="1"/>
<element type="ErdbVersion" minOccurs="0" maxOccurs="1"/>
<element type="EmbBlocks" minOccurs="0" maxOccurs="1"/>
</ElementType>

<ElementType name="MultiBlock" content="eltOnly" model="closed" order="many">
<element type="ErdbVersion" maxOccurs="1"/>
<element type="Model" maxOccurs="1"/>
<element type="Block" minOccurs="1" maxOccurs="*"/>
</ElementType>

which I have translated to XSD Schema as:

<xs:element name="BlockDef">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded" ecore:featureMap="">
<xs:element minOccurs="1" maxOccurs="1" ref="BlockName"/>
<xs:element minOccurs="0" maxOccurs="1" ref="EntityName"/>
<xs:element minOccurs="0" maxOccurs="1" ref="BlockId"/>
<xs:element minOccurs="0" maxOccurs="1" ref="BlockGUID"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="BlockDesc"/>
<xs:element minOccurs="1" maxOccurs="1" ref="TemplateName"/>
<xs:element minOccurs="0" maxOccurs="1" ref="ClassName"/>
<xs:element minOccurs="0" maxOccurs="1" ref="BaseTemplateName"/>
<xs:element minOccurs="0" maxOccurs="1" ref="Attribute"/>
<xs:element minOccurs="0" maxOccurs="1" ref="CreateType"/>
<xs:element minOccurs="0" maxOccurs="1" ref="BlockDoc"/>
<xs:element minOccurs="0" maxOccurs="1" ref="HandlerName"/>
<xs:element minOccurs="0" maxOccurs="1" ref="Coord"/>
<xs:element minOccurs="1" maxOccurs="1" ref="LifeCycleState"/>
<xs:element minOccurs="0" maxOccurs="1" ref="CeeName"/>
<xs:element minOccurs="0" maxOccurs="1" ref="AssignedTo"/>
<xs:element minOccurs="0" maxOccurs="1" ref="Container"/>
<xs:element minOccurs="0" maxOccurs="1" ref="HwDetail"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="SnlDataInfo"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="Reference"/>
</xs:choice>
</xs:complexType>
</xs:element>

<xs:element name="Block">
<xs:complexType>
<xs:all>
<xs:element maxOccurs="1" minOccurs="1" ref="BlockDef"/>
<xs:element minOccurs="0" maxOccurs="1" ref="Parameters"/>
<xs:element minOccurs="0" maxOccurs="1" ref="ProjParameters"/>
<xs:element minOccurs="0" maxOccurs="1" ref="SymbolAttrs"/>
<xs:element minOccurs="0" maxOccurs="1" ref="Connections"/>
<xs:element minOccurs="0" maxOccurs="1" ref="ErdbVersion"/>
<xs:element minOccurs="0" maxOccurs="1" ref="EmbBlocks"/>
</xs:all>
</xs:complexType>
</xs:element>

<xs:element name="MultiBlock">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded" ecore:featureMap="">
<xs:element minOccurs="0" maxOccurs="1" ref="ErdbVersion"/>
<xs:element minOccurs="0" maxOccurs="1" ref="Model"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="Block"/>
</xs:choice>
</xs:complexType>
</xs:element>



I had to use xsd:choice maxOccurs="unbounded" to properly describe the schema the data may be made available.

Originally, this schema produced an attribute called group that was of type EFeatureMapEntry.
After adding ecore:featureMap="" to the schema, this attribute was gone and I was very happy. I thought my problem was solved.

However, upon examining the generated BlockDefImpl class, I all attributes have been implemented as EList datatypes. I was expecting an EString for attributes that had their upper bound set to "1".

Is it possible to not get around FeatureMaps for my situation?

Thank you,

-Mark
Re: Querying properties that are EFeatureMapEntry Objects [message #693240 is a reply to message #693236] Wed, 06 July 2011 01:28 Go to previous messageGo to next message
Mark Sluser is currently offline Mark Sluser
Messages: 15
Registered: June 2011
Location: Calgary
Junior Member
Ok, I figured it out. I should have guessed.

It looks like the metamodel generated from the XSD file did not carry over the maxOccurs and minOccurs on xsd:choice elements when ecore:featureMap="". This sounds like a bug to me.
What do you think?

-Mark
Re: Querying properties that are EFeatureMapEntry Objects [message #693249 is a reply to message #693240] Wed, 06 July 2011 02:15 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4014
Registered: July 2009
Senior Member
HI Mark

The XSD to Ecore import is very useful, but precisely representing every
possible XSD eccentricity is challenging, and it looks as if you needed
to tweak a couple of attributes from your original XDR so I would guess
that the bug is in your tweaking, but I'm far from an XSD expert, so you
might try posting on the EMF newsgroup where you will get a more
informed response from Ed Merks.

Regards

Ed Willink


On 06/07/2011 06:28, Mark Sluser wrote:
> Ok, I figured it out. I should have guessed.
>
> It looks like the metamodel generated from the XSD file did not carry
> over the maxOccurs and minOccurs on xsd:choice elements when
> ecore:featureMap="". This sounds like a bug to me.
> What do you think?
>
> -Mark
Previous Topic:Code generation programatically
Next Topic:Creating concrete model using threading
Goto Forum:
  


Current Time: Sat Aug 02 00:35:29 EDT 2014

Powered by FUDForum. Page generated in 0.05757 seconds