Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » {xor} constraint(UML constraint OCL)
{xor} constraint [message #1739440] Mon, 01 August 2016 13:33 Go to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Last week I spotted the {xor} constraint between two associations the first time in a non-academic UML documentation.

This {xor} constraint is mentioned as figure 7.16 of the UML 2.5 specification.

I do not really miss it, but just out of curiosity: is it implemented in Papyrus?
I did not found it so far in Papyrus.

Greetings,
Carsten
Re: {xor} constraint [message #1739754 is a reply to message #1739440] Mon, 01 August 2016 14:31 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

Unfortunately Constraints fall into the chasm between UML and OCL
specifications.

In UML 1.x, the xor constraint might have been a Package.ownedRule with
an "xor" keyword-stereotype with the associations as constrained elements.

UML 2.x eliminated keyword-stereotypes.

Introduction of package-level constraints is under discussion for OCL
2.5, so Eclipse OCL's Namespace.ownedConstraints might host the
constraint. However encoding the "xor" is not obvious. It cannot be the
constraint name, since there might be two xor's in the same package.

Neon OCL: no support

Neon UML2: no idea how to do it ? OMG issue required

Neon Papyrus: probably not supported.

Does Papyrus have a solution or should we raise an OMG issue?

IMHO there should be an XORConstraint to encode it; using Constraint as
a dustbin for all possible constraint semantics does not work.

Regards

Ed Willink

On 01/08/2016 14:33, Carsten Pitz wrote:
> Last week I spotted the {xor} constraint between two associations the
> first time in a non-academic UML documentation.
>
> This {xor} constraint is mentioned as figure 7.16 of the UML 2.5
> specification.
>
> I do not really miss it, but just out of curiosity: is it implemented
> in Papyrus?
> I did not found it so far in Papyrus.
>
> Greetings,
> Carsten


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Re: {xor} constraint [message #1739911 is a reply to message #1739754] Fri, 05 August 2016 15:56 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Many, many thanks Ed

Your very comprehensive answer shows me you as implementator and I as a user share the very same pain on the {xor} constraint construct.

For me the rule
"In a modell all elements shall be unique identifiable and be well-defined."
is one of the most basic rules of modelling.

As you pointed out the {xor} constraint construct as defined in the UML 2.5 specification violates both aspects of the rule.

The naming issue could be solved by giving the {xor} constraint element a "Name" attribute. The generated, default name might be "xor_constraint_on_<name_of_named_element1>_and_<name_of_named_element2>". This name is somehow clumsy but should be unique. Doing so would degrade the "{xor}" to a mere graphical candy.

On the semantics:
The few times I had to deal with an {xor} constraint I asked the author:
What does it mean?
After getting no (useful) answer, I asked the refined questions
* What element (behavior) is responsible to ensure that constraint?
* Is it a pre- or post-condition or is it an invariant?
* What is the precise sematics of the {xor} constraint?

As a result we always ended up in replacing all {xor} constrains with constrains.

Based on that background I answer your question
should we raise an OMG issue?
with
yes, please mark the {xor} constraint deprecated and remove it from the specification as soon as possible

Many, many thanks
and
Regards

Carsten
Re: {xor} constraint [message #1741993 is a reply to message #1739754] Thu, 04 August 2016 19:47 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

In the absence of any xor knowledge,
http://issues.omg.org/browse/UMLR-703
raised.

Regards

Ed Willink

On 01/08/2016 15:31, Ed Willink wrote:
> Hi
>
> Unfortunately Constraints fall into the chasm between UML and OCL
> specifications.
>
> In UML 1.x, the xor constraint might have been a Package.ownedRule with
> an "xor" keyword-stereotype with the associations as constrained elements.
>
> UML 2.x eliminated keyword-stereotypes.
>
> Introduction of package-level constraints is under discussion for OCL
> 2.5, so Eclipse OCL's Namespace.ownedConstraints might host the
> constraint. However encoding the "xor" is not obvious. It cannot be the
> constraint name, since there might be two xor's in the same package.
>
> Neon OCL: no support
>
> Neon UML2: no idea how to do it ? OMG issue required
>
> Neon Papyrus: probably not supported.
>
> Does Papyrus have a solution or should we raise an OMG issue?
>
> IMHO there should be an XORConstraint to encode it; using Constraint as
> a dustbin for all possible constraint semantics does not work.
>
> Regards
>
> Ed Willink
>
> On 01/08/2016 14:33, Carsten Pitz wrote:
>> Last week I spotted the {xor} constraint between two associations the
>> first time in a non-academic UML documentation.
>>
>> This {xor} constraint is mentioned as figure 7.16 of the UML 2.5
>> specification.
>>
>> I do not really miss it, but just out of curiosity: is it implemented
>> in Papyrus?
>> I did not found it so far in Papyrus.
>>
>> Greetings,
>> Carsten
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Re: {xor} constraint [message #1741994 is a reply to message #1739911] Fri, 05 August 2016 16:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

The semantics is easy. It is a Package invariant affecting a1, a2.
Loosely, untested:

inv: let a1Ends = a1.memberEnd in
let a2Ends = a2.memberEnd in
let a12End = a1Ends->intersection(a2Ends)->any(true) in
let a1OtherEnd = a1Ends->excluding(a12End) in
let a2OtherEnd = a2Ends->excluding(a12End) in
a1OtherEnd->size() + a2OtherEnd->size() = 1

Many artefacts on a UML diagram are syntax sugar for constraints. Some
such as multiplicity are hard coded in the Abstract Syntax.

The utility of a syntax sugar is determined by frequency and ease of use
and difficulty of learning. {xor} is pretty marginal aesthetically.

{xor} is really unpleasant for a graphical implementation. I am not
aware of any other UML artefact that is an edge-to-edge edge. It might
even be prohibted by UMLDI.

Regards

Ed Willink

On 05/08/2016 16:56, Carsten Pitz wrote:
> Many, many thanks Ed
>
> Your very comprehensive answer shows me you as implementator and I as a
> user share the very same pain on the {xor} constraint construct.
>
> For me the rule
> "In a modell all elements shall be unique identifiable and be
> well-defined."
> is one of the most basic rules of modelling.
>
> As you pointed out the {xor} constraint construct as defined in the UML
> 2.5 specification violates both aspects of the rule.
>
> The naming issue could be solved by giving the {xor} constraint element
> a "Name" attribute. The generated, default name might be
> "xor_constraint_on_<name_of_named_element1>_and_<name_of_named_element2>".
> This name is somehow clumsy but should be unique. Doing so would degrade
> the "{xor}" to a mere graphical candy.
>
> On the semantics: The few times I had to deal with an {xor} constraint
> I asked the author:
> What does it mean?
> After getting no (useful) answer, I asked the refined questions
> * What element (behavior) is responsible to ensure that constraint?
> * Is it a pre- or post-condition or is it an invariant?
> * What is the precise sematics of the {xor} constraint?
>
> As a result we always ended up in replacing all {xor} constrains with
> constrains.
>
> Based on that background I answer your question
> should we raise an OMG issue?
> with
> yes, please mark the {xor} constraint deprecated and remove it from the
> specification as soon as possible
>
> Many, many thanks
> and
> Regards
>
> Carsten


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Re: {xor} constraint [message #1743154 is a reply to message #1741993] Mon, 12 September 2016 18:02 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Many thanks Ed,

Best regards,
Carsten
Re: {xor} constraint [message #1743155 is a reply to message #1741994] Mon, 12 September 2016 18:04 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Hi Ed,

in my little example attached I used a different semantics for XOR.

Best regard,
Carsten
Re: {xor} constraint [message #1743190 is a reply to message #1743155] Tue, 13 September 2016 07:28 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

Doh! Of course. It is much more elegant to have a constraint on the unique participant; the joining class. But once again, is a UML tool supposed to analyze the OCL expression to display {xor} rather than {or}?

Regards

Ed Willink
Re: {xor} constraint [message #1743192 is a reply to message #1743190] Tue, 13 September 2016 08:37 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Hi Ed,

I would rather interpret it the other way round. I think it is more obvious to make the {xor} constraint a constraint with a predefined semantic (= predefined OCL expression). In this interpretation the {xor} constraint would be a mere convenience feature. It creates a constraint, initializes some attributes with predefined values and makes those attributes immutable.

Best regards
Carsten
Re: {xor} constraint [message #1784176 is a reply to message #1739440] Fri, 23 March 2018 08:56 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
Is there any improvements or news about implementing this in papyrus ??

I need to implement something like:

index.php/fa/32430/0/

or

index.php/fa/32431/0/


Thanks in advance
Re: {xor} constraint [message #1784182 is a reply to message #1784176] Fri, 23 March 2018 09:19 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

In https://issues.omg.org/browse/UMLR-703 I tried to make some headway in respect of how an {xor} constraint might be persisted in a UML model. There was no agrrement, so even if you find some tool that supports it, it is unlikely that another tool will be compatible and quite possible that UML/OCL will evolve. In particular, even if Papyrus supports it, you need to be sure that the support is in a form that Eclipse OCL also supports.

Bottom line, this is perhaps just a bit of syntax sugar that is very rarely used, particularly since tool support is close to non-existent. It is unlikely ever to appear.

I strongly recommend that you use the equivalent verbose OCL constraint.

context Vehicle
inv XOR_vehicleLeased_vehicleSold: self.vehicleLeased->notEmpty() xor self.vehicleSold->notEmpty()

which makes clear that xor is probably wrong anyway. Surely there can be some vehicles awaiting a customer? So.

context Vehicle
inv NotLeasedAndSold: (self.vehicleLeased->size() + self.vehicleSold->size()) <= 1

Regards

Ed Willink
Re: {xor} constraint [message #1784183 is a reply to message #1784176] Fri, 23 March 2018 09:20 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Hi Eduardo,

both variants were and are still possible.

index.php/fa/32432/0/

Just the visual appearance is more expressive.

Or to make it even more expressive.

index.php/fa/32433/0/

/pica

[Updated on: Fri, 23 March 2018 09:43]

Report message to a moderator

Re: {xor} constraint [message #1784185 is a reply to message #1784182] Fri, 23 March 2018 09:59 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Hi Ed,
different assumptions, different solutions ;-)
Your solution is for sure technically better, my solution is more suitable to less experienced modeling teams.

@ Eduardo
choose the solution that fits your requirements better ;-)

/pica
Re: {xor} constraint [message #1784228 is a reply to message #1784183] Fri, 23 March 2018 18:07 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
BTW, I would prefer this alternate, much simpler modeling approach to achieve the same behavior.

index.php/fa/32435/0/

/pica
Re: {xor} constraint [message #1784241 is a reply to message #1784228] Sat, 24 March 2018 11:29 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
Can you pass me the code please... im trying to design following your example this constraint:

relationship between persons and film. There are 4 relations: actor, producer, screenwriter and director. I want to add the restriction that one person can be only one thing... ( or actor or producer or screenwriter or director). I cant use inheritance...

1 - Should i make the constraint in the person class or in every relation.....

What ive done :

index.php/fa/32436/0/

[Updated on: Sat, 24 March 2018 11:36]

Report message to a moderator

Re: {xor} constraint [message #1784243 is a reply to message #1784241] Sat, 24 March 2018 12:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

Where to place constraints should really be a matter of style.

For instance if you have a specification full of grand truths such as "no actor is a director", you might place all the constraints in the FilmIndustry class with an Actor.allInstances() as part of the implementation.

However few if any OCL tools have good allInstances() optimizations and so in practice you will get much better performance (and modularity) if you place the constraint in the class for which "self" is most useful and the OCL expression shortest. The Person class is probably good. Putting it in both class and relation is permissible, but likely to be very irritating since every violation will be reported multiple times.

Style notes:

not ... xor not ... is of course the same as ... xor ...

not ...->isEmpty() could be shortened to ...->notEmpty()

Your use of xor makes me very suspicious that you do not understand the difference between or and xor.

If you prohibit multiple roles, you will fail to model the film industry as it appears to be. Experienced actors/shoestring budgets frequently lead to multiple roles.

You might care to try googling class role since the problem of an object with varying/multiple types is often handled by the concept of roles for which inheritance might well work for you.

Regards

Ed Willink
Re: {xor} constraint [message #1784248 is a reply to message #1784243] Sat, 24 March 2018 17:29 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
Thanks for your help, i know the difference between xor and or, i was trying to adapt the previosus example of Carsten PitzFriend. What i dont know is anything related to OCL or constraints language.

In UML you simply draw a line across the relations and write Xor as the vehicle, company example posted some posts above. I only need to adapt this to my concrete problem. Is a problem of my degree on Computer and i have to write the constraint that an actor or producer or screenwriter
can only be one and no play more than one role.

Im not using roles here im using the relationships between fim and Person. I haven one person class and one film class. I made the relations to establish the actors of a film, the directors etc... and i have to add the constraint....

So if anybody can pass me the code or the xor costraint implemented the right way,itd be great.

Thanks again
Re: {xor} constraint [message #1784251 is a reply to message #1784248] Sat, 24 March 2018 18:30 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Hi Eduardo,
what is your reference for UML?
My and I suppose Ed will commit is the OMG UML specification. In the OMG UML specification the XOR visual notation is mentioned exactly once. That notation is neither explained nor marked mandatory.
As a result the XOR visual notation is nothing but a visual gimmick lacking a well defined semantics.
But if visual appearance is your main concern, Papyrus offers you free form graphics. These of course also lack a well defined semantic.

/pica

[Updated on: Sat, 24 March 2018 19:36]

Report message to a moderator

Re: {xor} constraint [message #1784259 is a reply to message #1784251] Sun, 25 March 2018 10:06 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
I dont have a reference, im using uml as teaching purpose. So i have to show different problems and cases to my pupils.

I wanted to implement in papyrus the example above of film and persons, and make clear the xor restriction.... i can always use paint or a line dash.... but:
1 - I want to learn how to do it in a professional way, possibly able to generate the code.
2 - If it was the case, note and make evidence things that can be added/modified in future papyrus releases.

So can you show me how you can implement the xor constraint in person class related to film roles ? Or is not possible in papyrus ??

Thanks again
Re: {xor} constraint [message #1784263 is a reply to message #1784259] Sun, 25 March 2018 16:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
HI

If you are teaching students, you should only teach them about xor constraints as part of a general warning to steer clear of what is poorly unspecified and badly implemented. In practice it is generally necessary to learn which dark corners of languages/tools to avoid.

You may choose to introduce them to NaturalLanguage constraints as Carsten explained. This at least enables the inadequacy of the model to be clarified.

But really you should use OCL constraints, since while UML is useful, there are limits to the complexity of constraints that can be handled by the graphical idioms alone. Ultimately non-trivial model constraints need a formal language and OCL is the traditional language for UML extension.

(OCL stereotype constraints are also poorly specified; Papyrus uses the Pivot-based OCL that prototypes solutions to many of the UML/OCL problems.)

Regards

Ed Willink
Re: {xor} constraint [message #1784291 is a reply to message #1784263] Mon, 26 March 2018 10:34 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
Ed Willink, can you upload the code or image or what to do in this concrete case ?? xor restriction between the relationships between two classes ? Qould be great as i dont need to study all the OCL language just for this....
The other constraint we are using is perfectly implemented in papyrus ( disjoint, complete constraints in inheritance)

Thanks in advance
Re: {xor} constraint [message #1784300 is a reply to message #1784291] Mon, 26 March 2018 12:11 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

I presume that you are joking. A UML tutor who has realized that OCL is necessary but refuses to learn it! Perhaps one of your students can help you.

You would of course need to provide the model against which the constraint is to be applied.

You could start by learning how to use a constraint with value "true" and one with value "false". Hardly an OCL learning exercise. Once you have done that you will find that my original reply of "self.vehicleLeased->notEmpty() xor self.vehicleSold->notEmpty()" is straightforward.

Regards

Ed Willink
Re: {xor} constraint [message #1784319 is a reply to message #1784300] Mon, 26 March 2018 17:11 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
[message #1784241 i

No im not joking, im teaching in some kind of post-obligatory studies ( college or professional) and i need to write the constrint in papyrus as appear in a solution of a problem. I can "paint" the solution but not writing in Papyrus and i vent found a tutorial or step by step example.
How to write lines, line start, line end and where to put the constraint and what to write inside.
I tried to adapt the example at message #1784183 but i get an error ( message #1784241)

Also its my first year teaching uml and its a course of 30 hours so OCL is out of the scope of the course.


Edit:

ive been working around and seems it works with OCL ... but i dont understand why it gives me no validation error because not(self.filmDirectors->isEmpty()) .... as directors are not included in constrained element. Ive deleted it just making tests....
Also i can draw only one context link line or link line, itd be great to draw a line to every point you need ( in this case to every relationship i guess ..
index.php/fa/32451/0/

Thanks in advance

[Updated on: Mon, 26 March 2018 19:10]

Report message to a moderator

Re: {xor} constraint [message #1784358 is a reply to message #1784319] Tue, 27 March 2018 08:47 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

You seem to think that screenshots are suitable for problem reporting. They are not, they help describe what you see but they do not allow any investigation of your problem since the underlying models must be re-entered probably ressulting in a different problem scenario. Without repro models I cannot comment on what you might have done wrong and what you might subsequently have done right.

Regards

Ed Willink
Re: {xor} constraint [message #1784362 is a reply to message #1784358] Tue, 27 March 2018 09:06 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
Sorry, i i have attached my project so youd save my life if you can take a look to the constraint. .. thanks in advance....sorry for any inconvenience

Edit: .So my second doubt is that constraint elements should be the class person or every relationship ( actor, director...) from fims to persons. I suppose its a matter of taste. The context constrained is class films i think... Thanks

[Updated on: Tue, 27 March 2018 09:37]

Report message to a moderator

Re: {xor} constraint [message #1784368 is a reply to message #1784362] Tue, 27 March 2018 09:47 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

Unfortunately you are using profiles that I do not have in my workspace and which are not available on the primary Eclipse installation site... I'm sorry, I do not have time to discover how to install them or to repair my workspace after bloating it with them.

But looking at the XMI I see

not ( self.filmActors->isEmpty() ) xor not(self.filmDirectors->isEmpty()) xor not(self.filmsProducers->isEmpty()) xor not(self.filmScreenWriters->isEmpty())

which is now a four way xor with redundant not's. I really cannot understand why you are interested in allowing 1 or 3 roles but not 0, 2 or 4. It seems to have no contact with reality. "or" would make much more sense in allowing 1,2,3,4 roles but prohibiting 0.

If you do not have time to understand OCL in a short course I recommend that you just mention that Constraints can be used, possibly using a NaturalLanguage constraint if your example is impossible without it. But if you want formality then you must learn to use OCL.

Regards

Ed Willink
Re: {xor} constraint [message #1784372 is a reply to message #1784368] Tue, 27 March 2018 09:58 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
Thanks Ed, i installed the papyrus Designer 1.0.5 and perhaps the profile to generate java code.
As said before is just a problem i have to write in Papyrus. The problem says that you have a film class and person class, and you have to establish relationships of actor,director, producer and screenwriter without using inheritance and apply the constraint that a person can only be one of the roles.
It has no logic as you mentioned before, but its an exercise.

So im planning to use natural language, but i want to learn at least this constraint ( is the unique constraint used in my course)..

This in your opinion would be correct ?:
1 - Restriction ( a person can be at maximum one role.... a person cant be a director and producer of the same film.... i know its just an exercise)
self.filmActors->isEmpty() xor self.filmDirectors->isEmpty()
xor self.filmsProducers->isEmpty() xor self.filmScreenWriters->isEmpty()

2 - Contrain context is Film.
3 - Constrainted elements the 4 relationships ( actor, director, producer, screenwriter ) or the class Person.

Thanks again for your effort and sorry my bad english...
Re: {xor} constraint [message #1784382 is a reply to message #1784372] Tue, 27 March 2018 11:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

If the problem is "at maximum one role", then the permitted total number of roles is 0 or 1, but not 2 or 3 or 4.

I would write it as:

filmActors->size() + filmDirectors->size() + filmsProducers->size() + filmScreenWriters->size() <= 1

Handling the 0 or 1 possibilities using Boolean logic is horrible; 'simplest' to enumerate all five four term combinations. Fewer terms and totally unreadable: Using xor you can enumerate just the four term nor case as the good 0 case good, then guard the xor 1/3 case with and nand to keep just the 1 case.

Regards

Ed Willink


Re: {xor} constraint [message #1784397 is a reply to message #1784382] Tue, 27 March 2018 15:29 Go to previous messageGo to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
Thanks again, this are ok suppose ??
2 - Contrain context is Film.
3 - Constrainted elements the 4 relationships ( actor, director, producer, screenwriter ) or the class Person.

One thing its not clear for me : when you propose
filmActors->size() + filmDirectors->size() + filmsProducers->size() + filmScreenWriters->size() <= 1
you assume that a film can have many actors, many producers but no one can have more than one role at once. ex: a film of 15 persons, you can have 2 directors, 3 procuders, 2 screenwriter and 8 actors.... but every one has only one role....
.
seems that with restriction ( ex: filmActors->size() +... <=1 ) it cant be 8 actors in a film ??

[Updated on: Tue, 27 March 2018 15:34]

Report message to a moderator

Re: {xor} constraint [message #1784422 is a reply to message #1784397] Tue, 27 March 2018 19:18 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6037
Registered: July 2009
Senior Member
Hi

Clearly I am unable to understand your non-real world example. It is generally difficult to provide an accurate formal expression for a vague or misunderstood specification.

Once you are clear as to what you want, I am sure you can identify an expression that coerresponds.

Regards

Ed Willink
Re: {xor} constraint [message #1784460 is a reply to message #1784422] Wed, 28 March 2018 08:40 Go to previous message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 28
Registered: December 2017
Junior Member
Thanks and sorry for my bad english.

One film is made by many persons. These persons are director, actor, screnwriter or producer. But the same person can only play one role at once.

ex: Larry, David, Jean are actors, Pere is director, Edward , Margaret are screnwriters and Malcolm is a producer.... No one can have more than one role. ex: Larry cant be actor and productor at the same time...

[Updated on: Wed, 28 March 2018 08:55]

Report message to a moderator

Previous Topic:Papyrus 3.3
Next Topic:CSS help to hide multiplicity, visibility and type of attributes
Goto Forum:
  


Current Time: Thu Sep 20 00:23:35 GMT 2018

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

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

Back to the top