Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » TimeEvent value setting
TimeEvent value setting [message #1708757] Sun, 20 September 2015 11:26 Go to next message
Muhammad Kashif is currently offline Muhammad KashifFriend
Messages: 52
Registered: April 2015
Member
Hello,

I am working on profile diagram in papyrus. I have made a stereotype "S1" and added "a1" as its attribute. The attribute "a1" is typed by uml metaclass "TimeEvent".

The stereotype "S1" is extended from UML metaclass "Class". Now when I apply that stereotype to a "block" in SysML BDD.. It then asks me to set the value of attribute "a1". What i am doing to set its value is just craeting a time event having "1second" in opaque expression.

The problem i am facing is that when i open my uml model in "Sample Reflective Ecore Model Editor" and then check there the value of "a1" using "interactive OCL", but it keeps returning me "false" as a result, whereas it should return "true" when i write already assigned value. Actually the "TimeEvent" is not being assigned any value..

I have tried all language in opaque expression.

Can anyone help me Please..
Thanks in advance

Regards,
Re: TimeEvent value setting [message #1708786 is a reply to message #1708757] Mon, 21 September 2015 08:38 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 927
Registered: February 2011
Senior Member
Hi,

Creating this profile/model works for me. Can you detail a little bit more what you are trying to do with Interactive OCL? (Which kind of query?)

Regards,
Camille


Camille Letavernier
Re: TimeEvent value setting [message #1708789 is a reply to message #1708757] Mon, 21 September 2015 08:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6851
Registered: July 2009
Senior Member
Hi

It is VERY unusual to open a UML model with the "Sample Reflective Ecore
Model Editor"; use the UML Model Editor that understands UML.

By "interactive OCL", I presume you mean the interactive OCL console,
which is suitable for evaluating OCL on instances, not on the classes
normally present in UML diagrams.

Without any repro, it is very difficult to make sense of what you write:
See https://wiki.eclipse.org/OCL/ForumNetiquette.

Regards

Ed Willink


On 20/09/2015 12:26, Ali Khan wrote:
> Hello,
>
> I am working on profile diagram in papyrus. I have made a stereotype
> "S1" and added "a1" as its attribute. The attribute "a1" is typed by
> uml metaclass "TimeEvent".
>
> The stereotype "S1" is extended from UML metaclass "Class". Now when I
> apply that stereotype to a "block" in SysML BDD.. It then asks me to
> set the value of attribute "a1". What i am doing to set its value is
> just craeting a time event having "1second" in opaque expression.
> The problem i am facing is that when i open my uml model in "Sample
> Reflective Ecore Model Editor" and then check there the value of "a1"
> using "interactive OCL", but it keeps returning me "false" as a
> result, whereas it should return "true" when i write already assigned
> value. Actually the "TimeEvent" is not being assigned any value..
> I have tried all language in opaque expression.
>
> Can anyone help me Please..
> Thanks in advance
>
> Regards,
Re: TimeEvent value setting [message #1708798 is a reply to message #1708789] Mon, 21 September 2015 10:29 Go to previous messageGo to next message
Muhammad Kashif is currently offline Muhammad KashifFriend
Messages: 52
Registered: April 2015
Member
Hi

I am creating a profile. Then I open that profile (uml file not di ) in "Sample Reflective Ecore Model Editor" which creates the dynamic instances of stereotypes automatically.

Then by using interactive OCL Console and by selecting "S1" stereotype's instance i check the value i have assigned to attribute "a1", which is typed by time event. I have assigned "a1"=5 but when i write "self.delay=5" it returns "false" whereas it should return true as I have already assigned a1=5.

May be I am assigning the value to a1 (which denotes timeevent) in a wrong way.
Can you please guide me how to assign the value to TimeEvent correctly?

Thankyou
Re: TimeEvent value setting [message #1708808 is a reply to message #1708798] Mon, 21 September 2015 11:49 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 927
Registered: February 2011
Senior Member
Hi,

If S1.a1 is a TimeEvent, then it is not possible to assign "5" to it. You need an instance of TimeEvent (TE1), with a "When" condition containing a TimeExpression, and the "expr" value of this expression may be an opaque expression (Or any other expression). So "at least" your OCL should follow this path of properties.

Assuming that "self" is the instance of your stereotype (S1), and you used an OpaqueExpression for specifying the TimeExpression, this should look like:

self.a1.when.expr.bodies.at(1) = 5


With:

a1 : TimeEvent
when : TimeExpression
expr: OpaqueExpression
bodies: String[*]

(And you probably need to add a few oclAsType() in the middle)

In your OCL example, I'm not sure what "delay" is. S1 doesn't have a "delay" property, and neither does TimeEvent, nor TimeExpression.

HTH,
Camille


Camille Letavernier

[Updated on: Mon, 21 September 2015 11:50]

Report message to a moderator

Re: TimeEvent value setting [message #1708816 is a reply to message #1708808] Mon, 21 September 2015 13:30 Go to previous messageGo to next message
Muhammad Kashif is currently offline Muhammad KashifFriend
Messages: 52
Registered: April 2015
Member
No Message Body
Re: TimeEvent value setting [message #1708820 is a reply to message #1708816] Mon, 21 September 2015 13:49 Go to previous messageGo to next message
Muhammad Kashif is currently offline Muhammad KashifFriend
Messages: 52
Registered: April 2015
Member
Thankyou for your response..
delay was actually "a1" typed by mistake in last OCL example..

I have set the value of "TimeEvent" in following way.. let me know if it is correct or not?

creating time event and setting SysML Model as its container --> clicking the "+" button in "when" open a new window "create new time expression" --> clicking on "+" button in "expr" open a list and i select "opaque Behavior" which open new window "create opaque expression" ---> i select OCL as language of opaque expression and write "5" in its body.

But when I try to write OCL expression like "self.a1.when.expr.bodies.at(1)=5". It does not access bodies by a "dot" after "expr".

and if i write self.a1.when.expr=5 it gives me false whereas it should give true as a result if the value is assigned correctly..

Please help..

Thankyou
Re: TimeEvent value setting [message #1708824 is a reply to message #1708820] Mon, 21 September 2015 14:12 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 927
Registered: February 2011
Senior Member
Hi,

OpaqueExpression can already contain a Language/Body; you don't need to add an OpaqueBehavior in the OpaqueExpression. My OCL example was matching the case where you have an OpaqueExpression without an OpaqueBehavior. If you add an OpaqueBehavior, then it should look like:

self.a1.when.expr.behavior.bodies->at(1) = 5


Quote:
But when I try to write OCL expression like "self.a1.when.expr.bodies.at(1)=5". It does not access bodies by a "dot" after "expr".


I did a few mistakes in my example. Since body is a multi-valued string, you need to use an arrow instead of a dot. Additionally, body seems to be a reserved keyword in OCL, so it needs to be escaped with "_". Finally, "body" is a String, so 5 needs to be put inside quotes. So it looks like:

self.a.when.expr.oclAsType(uml::OpaqueExpression)._body->at(1) = '5'


(Tested & verified, this time)

And if you use an intermediate OpaqueBehavior:

self.a.when.expr.oclAsType(uml::OpaqueExpression).behavior.oclAsType(uml::OpaqueBehavior)._body->at(1) = '4'


Quote:
and if i write self.a1.when.expr=5 it gives me false whereas it should give true as a result if the value is assigned correctly..


No, it shouldn't. The value of "expr" is not an Integer, so it will never return true if compared to an integer. The only case you might expect this expression to return true, is when "expr" is a LiteralInteger with value = 5, but in this case you actually need to write the following:

self.a.when.expr.oclAsType(uml::LiteralInteger).value = 5


(But then you don't use OpaqueExpression and/or OpaqueBehavior; that's a different model)

Camille


Camille Letavernier
Re: TimeEvent value setting [message #1708825 is a reply to message #1708824] Mon, 21 September 2015 14:26 Go to previous messageGo to next message
Muhammad Kashif is currently offline Muhammad KashifFriend
Messages: 52
Registered: April 2015
Member
Thanks it worked now..

Kindly let me that if we dont use suffix for time like "s", "m", "h" for second, minute and hours respectively what will it take..it by default.

if we want to use suffix how can we use?

thanks
Re: TimeEvent value setting [message #1708828 is a reply to message #1708825] Mon, 21 September 2015 14:55 Go to previous messageGo to next message
Muhammad Kashif is currently offline Muhammad KashifFriend
Messages: 52
Registered: April 2015
Member
PS, Can we assign a value to Time event as "litera String " literal integer" etc instead of "opaque expression".

And while assigning using opaque expression the 'behavior" and "type" boxes of opaque expression will be empty or should have some values.
Re: TimeEvent value setting [message #1708877 is a reply to message #1708828] Tue, 22 September 2015 07:43 Go to previous messageGo to next message
Muhammad Kashif is currently offline Muhammad KashifFriend
Messages: 52
Registered: April 2015
Member
PS: if we assign value to TimeEvent as literal string or literal integer say e.g 5. What does that mean?

whether to wait for for 5sec, 5min or what?

Please answer..
Thanks
Re: TimeEvent value setting [message #1708883 is a reply to message #1708877] Tue, 22 September 2015 08:43 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 927
Registered: February 2011
Senior Member
Hi,

I don't think that UML goes that far in the semantics of expressions. AFAIK, it doesn't have a standard library for advanced types such as Dates or Times. So, the semantics of "OpaqueExpression", "Literal String", "Literal Integer" and others, in this case, are undefined.

Profiles dedicated to RealTime such as Marte, or System Engineering such as SysML, might be able to fill this gap. Marte has a lot of concepts related to Time specification, and SysML has a more general concept of Values and Units.

HTH,
Camille


Camille Letavernier
Re: TimeEvent value setting [message #1708888 is a reply to message #1708883] Tue, 22 September 2015 09:27 Go to previous message
Muhammad Kashif is currently offline Muhammad KashifFriend
Messages: 52
Registered: April 2015
Member
But i think TimeEvent is the event that waits for preset time. It holds the control for the time you have defined.. This is what I know bout the TimeEvent. If it is not then what exactly TimeEvent is?
Previous Topic:Need help with Nat Tables, can't show the Classifier type
Next Topic:SysML full ports (nested ports)
Goto Forum:
  


Current Time: Mon Sep 28 19:07:07 GMT 2020

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

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

Back to the top