Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] Unspecified upper bound (-2)
[QVTO] Unspecified upper bound (-2) [message #95760] Thu, 20 November 2008 10:13 Go to next message
Eclipse UserFriend
Originally posted by: koen.yskout.cs.kuleuven.be

Hi,

When using a metamodel which contains an unspecified upper bound (i.e.,
-2), the QVTO transformation throws errors at me. This happens when the
unspecified upper bound is part of the target metamodel, and is assigned
a value in a mapping, e.g.,

unspecifiedUBElement := OrderedSet {
object SomeOtherClass {
name := 'foo';
}
}

Errors that I encountered:
org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeExcepti on: The
feature 'policy's type 'PolicyType' does not permit a value of type
'java.util.LinkedHashSet'

and

org.eclipse.m2m.internal.qvt.oml.emf.util.EmfException: Failed to save
model to platform:/resource/Test/files/output.example

Both of these errors do not occur when the upper bound is set to
unlimited (-1).

Can QVTO handle unspecified upper bounds? (I need them, because the
metamodels generated from XML Schemas appear to use them extensively).


Regards,
Koen
Re: [QVTO] Unspecified upper bound (-2) [message #95792 is a reply to message #95760] Thu, 20 November 2008 12:24 Go to previous messageGo to next message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi Koen,

QVTO should definitely handle this case,
you have found a bug
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=255953).

Thanks for pointing to this problem.

Regards,
/Radek


On Thu, 20 Nov 2008 11:13:22 +0100, Koen Yskout
<koen.yskout@cs.kuleuven.be> wrote:

> Hi,
>
> When using a metamodel which contains an unspecified upper bound (i.e.,
> -2), the QVTO transformation throws errors at me. This happens when the
> unspecified upper bound is part of the target metamodel, and is assigned
> a value in a mapping, e.g.,
>
> unspecifiedUBElement := OrderedSet {
> object SomeOtherClass {
> name := 'foo';
> }
> }
>
> Errors that I encountered:
> org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeExcepti on: The
> feature 'policy's type 'PolicyType' does not permit a value of type
> 'java.util.LinkedHashSet'
>
> and
>
> org.eclipse.m2m.internal.qvt.oml.emf.util.EmfException: Failed to save
> model to platform:/resource/Test/files/output.example
>
> Both of these errors do not occur when the upper bound is set to
> unlimited (-1).
>
> Can QVTO handle unspecified upper bounds? (I need them, because the
> metamodels generated from XML Schemas appear to use them extensively).
>
>
> Regards,
> Koen
Re: [QVTO] Unspecified upper bound (-2) [message #95805 is a reply to message #95760] Thu, 20 November 2008 13:01 Go to previous messageGo to next message
Sergey Boyko is currently offline Sergey BoykoFriend
Messages: 171
Registered: July 2009
Senior Member
Hi Koen ,

There's uncertain choice how to interpret metamodel feature with an
unspecified upper bound.
QVTO interpret it like a set (ordered or non-ordered). However actual
implementation can handle it in the way as single-value object. I tried
that and obtain generated setters that imply single value (either backed
with FeatureMap or simple class reference).

So solution here is that change script to the following:

unspecifiedUBElement += object SomeOtherClass {
name := 'foo';
}


Different case is dynamic MM.
With it feature setter allows any value for non-containment references
with upper bound (-2). However serialization fails with ClassCastEx..
since OCL's collections are not EObject's.

Quick fix is the same:

unspecifiedUBElement += object SomeOtherClass {
name := 'foo';
}
But resulted list would contain at most one object.


That inconsistent surely should be fixed. Will investigate that issue
more deeply.


Regards,
Sergey


Koen Yskout wrote:
> Hi,
>
> When using a metamodel which contains an unspecified upper bound (i.e.,
> -2), the QVTO transformation throws errors at me. This happens when the
> unspecified upper bound is part of the target metamodel, and is assigned
> a value in a mapping, e.g.,
>
> unspecifiedUBElement := OrderedSet {
> object SomeOtherClass {
> name := 'foo';
> }
> }
>
> Errors that I encountered:
> org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeExcepti on: The
> feature 'policy's type 'PolicyType' does not permit a value of type
> 'java.util.LinkedHashSet'
>
> and
>
> org.eclipse.m2m.internal.qvt.oml.emf.util.EmfException: Failed to save
> model to platform:/resource/Test/files/output.example
>
> Both of these errors do not occur when the upper bound is set to
> unlimited (-1).
>
> Can QVTO handle unspecified upper bounds? (I need them, because the
> metamodels generated from XML Schemas appear to use them extensively).
>
>
> Regards,
> Koen
Re: [QVTO] Unspecified upper bound (-2) [message #95820 is a reply to message #95805] Thu, 20 November 2008 14:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

Hi, Sergey,

As I understand it, the unspecified upper bound is only used in models
imported from XSDs, to support wildcard features. This facility
basically makes the use of ETypedElement::isMany() obsolete for
structural features; one should use FeatureMapUtil::isMany(...) to test
the multiplicity of a feature on a per-object basis.

Unfortunately, much of the QVT and OCL language infrastructure assumes
that multiplicities are known statically (at parse time), but this just
isn't true for these wildcard features. How are you planning to handle
this discontinuity in QVTo? Is there something that you will need from
OCL to support this?

Cheers,

Christian


Sergey Boyko wrote:
> Hi Koen ,
>
> There's uncertain choice how to interpret metamodel feature with an
> unspecified upper bound.
> QVTO interpret it like a set (ordered or non-ordered). However actual
> implementation can handle it in the way as single-value object. I tried
> that and obtain generated setters that imply single value (either backed
> with FeatureMap or simple class reference).
>
> So solution here is that change script to the following:
>
> unspecifiedUBElement += object SomeOtherClass {
> name := 'foo';
> }
>
>
> Different case is dynamic MM.
> With it feature setter allows any value for non-containment references
> with upper bound (-2). However serialization fails with ClassCastEx..
> since OCL's collections are not EObject's.
>
> Quick fix is the same:
>
> unspecifiedUBElement += object SomeOtherClass {
> name := 'foo';
> }
> But resulted list would contain at most one object.
>
>
> That inconsistent surely should be fixed. Will investigate that issue
> more deeply.
>
>
> Regards,
> Sergey
>
>
> Koen Yskout wrote:
>> Hi,
>>
>> When using a metamodel which contains an unspecified upper bound (i.e.,
>> -2), the QVTO transformation throws errors at me. This happens when the
>> unspecified upper bound is part of the target metamodel, and is assigned
>> a value in a mapping, e.g.,
>>
>> unspecifiedUBElement := OrderedSet {
>> object SomeOtherClass {
>> name := 'foo';
>> }
>> }
>>
>> Errors that I encountered:
>> org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeExcepti on: The
>> feature 'policy's type 'PolicyType' does not permit a value of type
>> 'java.util.LinkedHashSet'
>>
>> and
>>
>> org.eclipse.m2m.internal.qvt.oml.emf.util.EmfException: Failed to save
>> model to platform:/resource/Test/files/output.example
>>
>> Both of these errors do not occur when the upper bound is set to
>> unlimited (-1).
>>
>> Can QVTO handle unspecified upper bounds? (I need them, because the
>> metamodels generated from XML Schemas appear to use them extensively).
>>
>>
>> Regards,
>> Koen
Re: [QVTO] Unspecified upper bound (-2) [message #95834 is a reply to message #95820] Thu, 20 November 2008 15:32 Go to previous message
Sergey Boyko is currently offline Sergey BoykoFriend
Messages: 171
Registered: July 2009
Senior Member
Hi Christian ,

Thank you for pointing on FeatureMapUtil::isMany(..) !

Good inference from the source that isMany() output relates only to
object's EClass representation. So that it constant at parse and runtime.
At the moment I'm not sure if the changes needed in QVTO would require
support from OCL or we be able to wrap them in our implementation.

Regards,
Sergey


Christian W. Damus wrote:
> Hi, Sergey,
>
> As I understand it, the unspecified upper bound is only used in models
> imported from XSDs, to support wildcard features. This facility
> basically makes the use of ETypedElement::isMany() obsolete for
> structural features; one should use FeatureMapUtil::isMany(...) to test
> the multiplicity of a feature on a per-object basis.
>
> Unfortunately, much of the QVT and OCL language infrastructure assumes
> that multiplicities are known statically (at parse time), but this just
> isn't true for these wildcard features. How are you planning to handle
> this discontinuity in QVTo? Is there something that you will need from
> OCL to support this?
>
> Cheers,
>
> Christian
>
>
> Sergey Boyko wrote:
>> Hi Koen ,
>>
>> There's uncertain choice how to interpret metamodel feature with an
>> unspecified upper bound.
>> QVTO interpret it like a set (ordered or non-ordered). However actual
>> implementation can handle it in the way as single-value object. I
>> tried that and obtain generated setters that imply single value
>> (either backed with FeatureMap or simple class reference).
>>
>> So solution here is that change script to the following:
>>
>> unspecifiedUBElement += object SomeOtherClass {
>> name := 'foo';
>> }
>>
>>
>> Different case is dynamic MM.
>> With it feature setter allows any value for non-containment references
>> with upper bound (-2). However serialization fails with ClassCastEx..
>> since OCL's collections are not EObject's.
>>
>> Quick fix is the same:
>>
>> unspecifiedUBElement += object SomeOtherClass {
>> name := 'foo';
>> }
>> But resulted list would contain at most one object.
>>
>>
>> That inconsistent surely should be fixed. Will investigate that issue
>> more deeply.
>>
>>
>> Regards,
>> Sergey
>>
>>
>> Koen Yskout wrote:
>>> Hi,
>>>
>>> When using a metamodel which contains an unspecified upper bound (i.e.,
>>> -2), the QVTO transformation throws errors at me. This happens when the
>>> unspecified upper bound is part of the target metamodel, and is assigned
>>> a value in a mapping, e.g.,
>>>
>>> unspecifiedUBElement := OrderedSet {
>>> object SomeOtherClass {
>>> name := 'foo';
>>> }
>>> }
>>>
>>> Errors that I encountered:
>>> org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeExcepti on: The
>>> feature 'policy's type 'PolicyType' does not permit a value of type
>>> 'java.util.LinkedHashSet'
>>>
>>> and
>>>
>>> org.eclipse.m2m.internal.qvt.oml.emf.util.EmfException: Failed to save
>>> model to platform:/resource/Test/files/output.example
>>>
>>> Both of these errors do not occur when the upper bound is set to
>>> unlimited (-1).
>>>
>>> Can QVTO handle unspecified upper bounds? (I need them, because the
>>> metamodels generated from XML Schemas appear to use them extensively).
>>>
>>>
>>> Regards,
>>> Koen
Previous Topic:[ATL] Getting imported packages of a model
Next Topic:[ATL] Conditions on all source elements of multiple source pattern
Goto Forum:
  


Current Time: Thu Apr 25 10:16:39 GMT 2024

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

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

Back to the top