Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How impl "xsd:choice" model constraint ?
How impl "xsd:choice" model constraint ? [message #52512] Wed, 20 September 2006 18:23 Go to next message
Eclipse UserFriend
Originally posted by: tiggo.kan.gmail.com

Hello,

As illustrated in a tutorial, a simple ocl-based constraint can be
supported in gmfmap model, But I know little about OCL... Just wonder
whether "<xsd:choice>" constraint can be expressed by OCL? If can, GMF
also can generate such codes?
In my semantic model, "<xsd:choice>" is used on a container, which has
such restriction on children.

thanks for any suggestion.

regards / tiggo
Re: How impl "xsd:choice" model constraint ? [message #52813 is a reply to message #52512] Thu, 21 September 2006 12:40 Go to previous messageGo to next message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi tiggo,

GMF does not process <xsd:choice> at all.
Please, check if EMF is able to use xsd:choice elements in EMF validation
mechanism.
If yes, GMF validation involves EMF validators automatically and visualizes
the resulting diagnostics (if validation enabled).

As for expressing it in OCL, in principal you can do it (manually ;)). It
just depends on how complex the constraint is and
whether OCL is straightforward tool for this.

Regards,
/Radek

"tiggo" <tiggo.kan@gmail.com> wrote in message
news:ees0uk$vf9$1@utils.eclipse.org...
> Hello,
>
> As illustrated in a tutorial, a simple ocl-based constraint can be
> supported in gmfmap model, But I know little about OCL... Just wonder
> whether "<xsd:choice>" constraint can be expressed by OCL? If can, GMF
> also can generate such codes?
> In my semantic model, "<xsd:choice>" is used on a container, which has
> such restriction on children.
>
> thanks for any suggestion.
>
> regards / tiggo
Re: How impl "xsd:choice" model constraint ? [message #52840 is a reply to message #52512] Thu, 21 September 2006 13:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Tiggo,

I am assuming that an XSD Choice construct will be generated by EMF as a
FeatureMap (Ed correct me if I am wrong). In any case, there will be two
or more EStructuralFeatures (OCL properties) that are mutually exclusive.
If your XSD element definition for <x> has a choice between elements <a>,
<b>, and <c>, then an OCL constraint expressing the choice might look like:

(not a->isEmpty() implies b->isEmpty() and c->isEmpty()) and
(not b->isEmpty() implies a->isEmpty() and c->isEmpty()) and
(not c->isEmpty() implies a->isEmpty() and b->isEmpty())

Or, more succinctly,

Bag{}->including(
a->isEmpty())->including(
b->isEmpty())->including(
c->isEmpty())
= Bag{true, true, false}

HTH,

Christian


tiggo wrote:

> Hello,
>
> As illustrated in a tutorial, a simple ocl-based constraint can be
> supported in gmfmap model, But I know little about OCL... Just wonder
> whether "<xsd:choice>" constraint can be expressed by OCL? If can, GMF
> also can generate such codes?
> In my semantic model, "<xsd:choice>" is used on a container, which has
> such restriction on children.
>
> thanks for any suggestion.
>
> regards / tiggo
Re: How impl "xsd:choice" model constraint ? [message #52867 is a reply to message #52813] Thu, 21 September 2006 13:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------020305030703090704000500
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Radek,

No, EMF doesn't currently validate "complex" particle constraints. It's
our oldest feature request to do that and I have prototyped an approach
for doing so:
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210>

https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210

I'm pretty sure OCL could be used to express mutual exclusion type of
constraint. I've asked Christian to have a look at this question and
added the EMFT newsgroup, which is a better place to ask about OCL...


Radek Dvorak wrote:
> Hi tiggo,
>
> GMF does not process <xsd:choice> at all.
> Please, check if EMF is able to use xsd:choice elements in EMF validation
> mechanism.
> If yes, GMF validation involves EMF validators automatically and visualizes
> the resulting diagnostics (if validation enabled).
>
> As for expressing it in OCL, in principal you can do it (manually ;)). It
> just depends on how complex the constraint is and
> whether OCL is straightforward tool for this.
>
> Regards,
> /Radek
>
> "tiggo" <tiggo.kan@gmail.com> wrote in message
> news:ees0uk$vf9$1@utils.eclipse.org...
>
>> Hello,
>>
>> As illustrated in a tutorial, a simple ocl-based constraint can be
>> supported in gmfmap model, But I know little about OCL... Just wonder
>> whether "<xsd:choice>" constraint can be expressed by OCL? If can, GMF
>> also can generate such codes?
>> In my semantic model, "<xsd:choice>" is used on a container, which has
>> such restriction on children.
>>
>> thanks for any suggestion.
>>
>> regards / tiggo
>>
>
>
>


--------------020305030703090704000500
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Radek,<br>
<br>
No, EMF doesn't currently validate "complex" particle constraints.&nbsp;
It's our oldest feature request to do that and I have prototyped an
approach for doing so:<a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210"><br>
</a>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210">https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210</a><br>
</blockquote>
I'm pretty sure OCL could be used to express mutual exclusion type of
constraint.&nbsp; I've asked Christian to have a look at this question and
added the EMFT newsgroup, which is a better place to ask about OCL...<br>
<br>
<br>
Radek Dvorak wrote:
<blockquote cite="mideeu186$gli$1@utils.eclipse.org" type="cite">
<pre wrap="">Hi tiggo,

GMF does not process &lt;xsd:choice&gt; at all.
Please, check if EMF is able to use xsd:choice elements in EMF validation
mechanism.
If yes, GMF validation involves EMF validators automatically and visualizes
the resulting diagnostics (if validation enabled).

As for expressing it in OCL, in principal you can do it (manually ;)). It
just depends on how complex the constraint is and
whether OCL is straightforward tool for this.

Regards,
/Radek

"tiggo" <a class="moz-txt-link-rfc2396E" href="mailto:tiggo.kan@gmail.com">&lt;tiggo.kan@gmail.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:ees0uk$vf9$1@utils.eclipse.org">news:ees0uk$vf9$1@utils.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Hello,

As illustrated in a tutorial, a simple ocl-based constraint can be
supported in gmfmap model, But I know little about OCL... Just wonder
whether "&lt;xsd:choice&gt;" constraint can be expressed by OCL? If can, GMF
also can generate such codes?
In my semantic model, "&lt;xsd:choice&gt;" is used on a container, which has
such restriction on children.

thanks for any suggestion.

regards / tiggo
</pre>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
<br>
</body>
</html>

--------------020305030703090704000500--
Re: How impl "xsd:choice" model constraint ? [message #52894 is a reply to message #52840] Thu, 21 September 2006 13:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------080507060101000909080209
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Christian,

Actually, EMF treats choice effectively the same as sequence (thereby
losing the mutual exclusion constraint); feature maps are only generated
to preserve relative element order and to capture wildcard or
substitution group information. But I think your answer is still
correct (although I'm not sure if isEmpty applies to single valued
features)...


Christian W. Damus wrote:
> Hi, Tiggo,
>
> I am assuming that an XSD Choice construct will be generated by EMF as a
> FeatureMap (Ed correct me if I am wrong). In any case, there will be two
> or more EStructuralFeatures (OCL properties) that are mutually exclusive.
> If your XSD element definition for <x> has a choice between elements <a>,
> <b>, and <c>, then an OCL constraint expressing the choice might look like:
>
> (not a->isEmpty() implies b->isEmpty() and c->isEmpty()) and
> (not b->isEmpty() implies a->isEmpty() and c->isEmpty()) and
> (not c->isEmpty() implies a->isEmpty() and b->isEmpty())
>
> Or, more succinctly,
>
> Bag{}->including(
> a->isEmpty())->including(
> b->isEmpty())->including(
> c->isEmpty())
> = Bag{true, true, false}
>
> HTH,
>
> Christian
>
>
> tiggo wrote:
>
>
>> Hello,
>>
>> As illustrated in a tutorial, a simple ocl-based constraint can be
>> supported in gmfmap model, But I know little about OCL... Just wonder
>> whether "<xsd:choice>" constraint can be expressed by OCL? If can, GMF
>> also can generate such codes?
>> In my semantic model, "<xsd:choice>" is used on a container, which has
>> such restriction on children.
>>
>> thanks for any suggestion.
>>
>> regards / tiggo
>>
>
>


--------------080507060101000909080209
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Christian,<br>
<br>
Actually, EMF treats choice effectively the same as sequence (thereby
losing the mutual exclusion constraint); feature maps are only
generated to preserve relative element order and to capture wildcard or
substitution group information.&nbsp; But I think your answer is still
correct (although I'm not sure if isEmpty applies to single valued
features)...<br>
<br>
<br>
Christian W. Damus wrote:
<blockquote cite="mideeu3gq$uvs$1@utils.eclipse.org" type="cite">
<pre wrap="">Hi, Tiggo,

I am assuming that an XSD Choice construct will be generated by EMF as a
FeatureMap (Ed correct me if I am wrong). In any case, there will be two
or more EStructuralFeatures (OCL properties) that are mutually exclusive.
If your XSD element definition for &lt;x&gt; has a choice between elements &lt;a&gt;,
&lt;b&gt;, and &lt;c&gt;, then an OCL constraint expressing the choice might look like:

(not a-&gt;isEmpty() implies b-&gt;isEmpty() and c-&gt;isEmpty()) and
(not b-&gt;isEmpty() implies a-&gt;isEmpty() and c-&gt;isEmpty()) and
(not c-&gt;isEmpty() implies a-&gt;isEmpty() and b-&gt;isEmpty())

Or, more succinctly,

Bag{}-&gt;including(
a-&gt;isEmpty())-&gt;including(
b-&gt;isEmpty())-&gt;including(
c-&gt;isEmpty())
= Bag{true, true, false}

HTH,

Christian


tiggo wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Hello,

As illustrated in a tutorial, a simple ocl-based constraint can be
supported in gmfmap model, But I know little about OCL... Just wonder
whether "&lt;xsd:choice&gt;" constraint can be expressed by OCL? If can, GMF
also can generate such codes?
In my semantic model, "&lt;xsd:choice&gt;" is used on a container, which has
such restriction on children.

thanks for any suggestion.

regards / tiggo
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------080507060101000909080209--
Re: How impl "xsd:choice" model constraint ? [message #52980 is a reply to message #52894] Thu, 21 September 2006 14:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Thanks, Ed, for the clarification.

And, yes, isEmpty() works for scalar features because applying collection
operations (those preceded by '->') to scalars coerces them to Sets of zero
or one member. That was the tricky bit :-)

Cheers,

Christian


Ed Merks wrote:

> Christian,
>
> Actually, EMF treats choice effectively the same as sequence (thereby
> losing the mutual exclusion constraint); feature maps are only generated
> to preserve relative element order and to capture wildcard or
> substitution group information. But I think your answer is still
> correct (although I'm not sure if isEmpty applies to single valued
> features)...
>
>
> Christian W. Damus wrote:
>> Hi, Tiggo,
>>
>> I am assuming that an XSD Choice construct will be generated by EMF as a
>> FeatureMap (Ed correct me if I am wrong). In any case, there will be two
>> or more EStructuralFeatures (OCL properties) that are mutually exclusive.
>> If your XSD element definition for <x> has a choice between elements <a>,
>> <b>, and <c>, then an OCL constraint expressing the choice might look
>> like:
>>
>> (not a->isEmpty() implies b->isEmpty() and c->isEmpty()) and
>> (not b->isEmpty() implies a->isEmpty() and c->isEmpty()) and
>> (not c->isEmpty() implies a->isEmpty() and b->isEmpty())
>>
>> Or, more succinctly,
>>
>> Bag{}->including(
>> a->isEmpty())->including(
>> b->isEmpty())->including(
>> c->isEmpty())
>> = Bag{true, true, false}
>>
>> HTH,
>>
>> Christian
>>
>>
>> tiggo wrote:
>>
>>
>>> Hello,
>>>
>>> As illustrated in a tutorial, a simple ocl-based constraint can be
>>> supported in gmfmap model, But I know little about OCL... Just wonder
>>> whether "<xsd:choice>" constraint can be expressed by OCL? If can, GMF
>>> also can generate such codes?
>>> In my semantic model, "<xsd:choice>" is used on a container, which has
>>> such restriction on children.
>>>
>>> thanks for any suggestion.
>>>
>>> regards / tiggo
>>>
>>
>>
Re: How impl "xsd:choice" model constraint ? [message #53005 is a reply to message #52867] Thu, 21 September 2006 14:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, all,

See my reply to the other branch of this thread in the GMF newsgroup (sorry,
should have cross-posted my reply).

Christian


Ed Merks wrote:

> Radek,
>
> No, EMF doesn't currently validate "complex" particle constraints. It's
> our oldest feature request to do that and I have prototyped an approach
> for doing so:
> <https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210>
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210
>
> I'm pretty sure OCL could be used to express mutual exclusion type of
> constraint. I've asked Christian to have a look at this question and
> added the EMFT newsgroup, which is a better place to ask about OCL...
>
>
> Radek Dvorak wrote:
>> Hi tiggo,
>>
>> GMF does not process <xsd:choice> at all.
>> Please, check if EMF is able to use xsd:choice elements in EMF validation
>> mechanism.
>> If yes, GMF validation involves EMF validators automatically and
>> visualizes the resulting diagnostics (if validation enabled).
>>
>> As for expressing it in OCL, in principal you can do it (manually ;)). It
>> just depends on how complex the constraint is and
>> whether OCL is straightforward tool for this.
>>
>> Regards,
>> /Radek
>>
>> "tiggo" <tiggo.kan@gmail.com> wrote in message
>> news:ees0uk$vf9$1@utils.eclipse.org...
>>
>>> Hello,
>>>
>>> As illustrated in a tutorial, a simple ocl-based constraint can be
>>> supported in gmfmap model, But I know little about OCL... Just wonder
>>> whether "<xsd:choice>" constraint can be expressed by OCL? If can, GMF
>>> also can generate such codes?
>>> In my semantic model, "<xsd:choice>" is used on a container, which has
>>> such restriction on children.
>>>
>>> thanks for any suggestion.
>>>
>>> regards / tiggo
>>>
>>
>>
>>
Re: How impl "xsd:choice" model constraint ? [message #53029 is a reply to message #52980] Thu, 21 September 2006 14:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Oops! Demerit point for me. A much more concise (and readable) constraint
would be:

Bag{a->isEmpty(), b->isEmpty(), c->isEmpty()} = Bag{true, true, false}

Christian


Christian W. Damus wrote:

>
> Thanks, Ed, for the clarification.
>
> And, yes, isEmpty() works for scalar features because applying collection
> operations (those preceded by '->') to scalars coerces them to Sets of
> zero
> or one member. That was the tricky bit :-)
>
> Cheers,
>
> Christian
>
>
> Ed Merks wrote:
>
>> Christian,
>>
>> Actually, EMF treats choice effectively the same as sequence (thereby
>> losing the mutual exclusion constraint); feature maps are only generated
>> to preserve relative element order and to capture wildcard or
>> substitution group information. But I think your answer is still
>> correct (although I'm not sure if isEmpty applies to single valued
>> features)...
>>
>>
>> Christian W. Damus wrote:
>>> Hi, Tiggo,
>>>
>>> I am assuming that an XSD Choice construct will be generated by EMF as a
>>> FeatureMap (Ed correct me if I am wrong). In any case, there will be
>>> two or more EStructuralFeatures (OCL properties) that are mutually
>>> exclusive. If your XSD element definition for <x> has a choice between
>>> elements <a>, <b>, and <c>, then an OCL constraint expressing the choice
>>> might look like:
>>>
>>> (not a->isEmpty() implies b->isEmpty() and c->isEmpty()) and
>>> (not b->isEmpty() implies a->isEmpty() and c->isEmpty()) and
>>> (not c->isEmpty() implies a->isEmpty() and b->isEmpty())
>>>
>>> Or, more succinctly,
>>>
>>> Bag{}->including(
>>> a->isEmpty())->including(
>>> b->isEmpty())->including(
>>> c->isEmpty())
>>> = Bag{true, true, false}
>>>
>>> HTH,
>>>
>>> Christian
>>>
>>>
>>> tiggo wrote:
>>>
>>>
>>>> Hello,
>>>>
>>>> As illustrated in a tutorial, a simple ocl-based constraint can be
>>>> supported in gmfmap model, But I know little about OCL... Just wonder
>>>> whether "<xsd:choice>" constraint can be expressed by OCL? If can, GMF
>>>> also can generate such codes?
>>>> In my semantic model, "<xsd:choice>" is used on a container, which has
>>>> such restriction on children.
>>>>
>>>> thanks for any suggestion.
>>>>
>>>> regards / tiggo
>>>>
>>>
>>>
Re: How impl "xsd:choice" model constraint ? [message #53186 is a reply to message #53029] Thu, 21 September 2006 17:22 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Or, even:

Bag{a->notEmpty(), b->notEmpty(), c->notEmpty()}->one(e | e)

Isn't OCL wonderful?

:-D



Christian W. Damus wrote:

>
> Oops! Demerit point for me. A much more concise (and readable) constraint
> would be:
>
> Bag{a->isEmpty(), b->isEmpty(), c->isEmpty()} = Bag{true, true, false}
>
> Christian
>
>
> Christian W. Damus wrote:
>
>>
>> Thanks, Ed, for the clarification.
>>
>> And, yes, isEmpty() works for scalar features because applying collection
>> operations (those preceded by '->') to scalars coerces them to Sets of
>> zero
>> or one member. That was the tricky bit :-)
>>
>> Cheers,
>>
>> Christian
>>
>>
>> Ed Merks wrote:
>>
>>> Christian,
>>>
>>> Actually, EMF treats choice effectively the same as sequence (thereby
>>> losing the mutual exclusion constraint); feature maps are only generated
>>> to preserve relative element order and to capture wildcard or
>>> substitution group information. But I think your answer is still
>>> correct (although I'm not sure if isEmpty applies to single valued
>>> features)...
>>>
>>>
>>> Christian W. Damus wrote:
>>>> Hi, Tiggo,
>>>>
>>>> I am assuming that an XSD Choice construct will be generated by EMF as
>>>> a
>>>> FeatureMap (Ed correct me if I am wrong). In any case, there will be
>>>> two or more EStructuralFeatures (OCL properties) that are mutually
>>>> exclusive. If your XSD element definition for <x> has a choice between
>>>> elements <a>, <b>, and <c>, then an OCL constraint expressing the
>>>> choice might look like:
>>>>
>>>> (not a->isEmpty() implies b->isEmpty() and c->isEmpty()) and
>>>> (not b->isEmpty() implies a->isEmpty() and c->isEmpty()) and
>>>> (not c->isEmpty() implies a->isEmpty() and b->isEmpty())
>>>>
>>>> Or, more succinctly,
>>>>
>>>> Bag{}->including(
>>>> a->isEmpty())->including(
>>>> b->isEmpty())->including(
>>>> c->isEmpty())
>>>> = Bag{true, true, false}
>>>>
>>>> HTH,
>>>>
>>>> Christian
>>>>
>>>>
>>>> tiggo wrote:
>>>>
>>>>
>>>>> Hello,
>>>>>
>>>>> As illustrated in a tutorial, a simple ocl-based constraint can be
>>>>> supported in gmfmap model, But I know little about OCL... Just wonder
>>>>> whether "<xsd:choice>" constraint can be expressed by OCL? If can, GMF
>>>>> also can generate such codes?
>>>>> In my semantic model, "<xsd:choice>" is used on a container, which has
>>>>> such restriction on children.
>>>>>
>>>>> thanks for any suggestion.
>>>>>
>>>>> regards / tiggo
>>>>>
>>>>
>>>>
Previous Topic:Properties view
Next Topic:is it possible for multiple plugins to contribute to the same editor?
Goto Forum:
  


Current Time: Sat Oct 19 10:55:27 GMT 2024

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

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

Back to the top