Home » Modeling » GMF (Graphical Modeling Framework) » How impl "xsd:choice" model constraint ?
How impl "xsd:choice" model constraint ? [message #52512] |
Wed, 20 September 2006 14:23  |
Eclipse User |
|
|
|
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 08:40   |
Eclipse User |
|
|
|
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 09:19   |
Eclipse User |
|
|
|
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 09:24   |
Eclipse User |
|
|
|
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.
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. 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 <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" <a class="moz-txt-link-rfc2396E" href="mailto:tiggo.kan@gmail.com"><tiggo.kan@gmail.com></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 "<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
</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 09:32   |
Eclipse User |
|
|
|
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. 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 <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:
</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 "<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
</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 10:10   |
Eclipse User |
|
|
|
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 10:12   |
Eclipse User |
|
|
|
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 10:14   |
Eclipse User |
|
|
|
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 13:22  |
Eclipse User |
|
|
|
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
>>>>>
>>>>
>>>>
|
|
|
Goto Forum:
Current Time: Wed Apr 30 19:35:14 EDT 2025
Powered by FUDForum. Page generated in 0.07114 seconds
|