Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » How to access to attributes in other classes?
How to access to attributes in other classes? [message #763690] Sat, 10 December 2011 10:24 Go to next message
Forenmailadresse is currently offline ForenmailadresseFriend
Messages: 3
Registered: December 2011
Junior Member
Hello community.

First of all, I have to say, that my english isn't very well, sorry for that.
Second part, I have to say is, that I'm new to OCL, that's the reason for my question and I hope, you can help me solving the problem.

I try to create a "post"-OCL expression for the phenomenon "sndCreatePollReq". In this expression, there should be an pollDS-DataSet in the PollDataBase, where title, description and options are the same as the parameters sended with "sndCreatePollReq".

Hope, you can see the following screenshot.
index.php/fa/6416/0/


The problem is, that I have no idea, how to do it right. How can I get access to the pollDS-DataSets in the PollDataBase?

I tried this:
Set {self.PollDataBase.pollDS}->exists(pollDS) and
webPage^sndHandledPollDS()

And it throws the following error message: "Unrecognized variable: (pollDS)"
How to declare a varialbe from type PollDataSet, of which pollDS should be?

Is there a realy good tutorial out there, where I could learn the expressions used in OCL? Such as "->" an how to use them right?

Greetings and thanks for help, Stefan

[Updated on: Sat, 10 December 2011 10:27]

Report message to a moderator

Re: How to access to attributes in other classes? [message #763702 is a reply to message #763690] Sat, 10 December 2011 10:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Your screenshot has no PollDataBase, no pollDS and no sndCreatePollReq,
so its difficult to guess at what the context might be for self and what
relationships you are trying to navigate.

Just looking at your expression, you seem to be doing a double
navigation of pollDS, so perhaps

self.PollDataBase->exists(pollDS)

is what you were trying to do.

Regards

Ed Willink

On 10/12/2011 10:24, Forenmailadresse wrote:
> Hello community.
>
> First of all, I have to say, that my english isn't very well, sorry for that.
> Second part, I have to say is, that I'm new to OCL, that's the reason for my question and I hope, you can help me solving the problem.
>
> I try to create a "post"-OCL expression for the phenomenon "sndCreatePollReq". In this expression, there should be an pollDS-DataSet in the PollDataBase, where title, description and options are the same as the parameters sended with "sndCreatePollReq".
>
> Hope, you can see the following screenshot.
>
>
>
> The problem is, that I have no idea, how to do it right. How can I get access to the pollDS-DataSets in the PollDataBase?
>
> I tried this:
> Set {self.PollDataBase.pollDS}->exists(pollDS) and
> webPage^sndHandledPollDS()
>
> And it throws the following error message: "Unrecognized variable: (pollDS)"
> How to declare a varialbe from type PollDataSet, of which pollDS should be?
>
> Is there a realy good tutorial out there, where I could learn the expressions used in OCL? Such as "->" an how to use them right?
>
> Greetings and thanks for help, Stefan
Re: How to access to attributes in other classes? [message #763705 is a reply to message #763702] Sat, 10 December 2011 11:11 Go to previous messageGo to next message
Forenmailadresse is currently offline ForenmailadresseFriend
Messages: 3
Registered: December 2011
Junior Member
Edward Willink wrote on Sat, 10 December 2011 05:57
Hi

Your screenshot has no PollDataBase, no pollDS and no sndCreatePollReq,
so its difficult to guess at what the context might be for self and what
relationships you are trying to navigate.

Just looking at your expression, you seem to be doing a double
navigation of pollDS, so perhaps

self.PollDataBase->exists(pollDS)

is what you were trying to do.

Regards

Ed Willink

Sorry for the wrong screenshot! I saw it to late, but now there has to be the right one.

I just tried self.PollDataBase->exists(pollDS), but in this case, the error message I get was:
Iterate Expression body type must be boolean (Set {self.PollDataBase}->exists(temp1 : PollDataBase | temp1.pollDS))

So I'm searching arround the internet and reading some PDFs to find out, how to realise the post-condition in OCL - till yet with no result Sad

I hope, someone can help me, or I'll find the answer by myself.

Never the less, thanks for your answer.

Regards, Stefan

EDIT:
I think, the right way is:
PollDataBase->exists(pollDS |
pollDS.title = title and
pollDS.description = description and
pollDS.options = options) and
webPage^sndHandledPollDS()

But in this case, I get an error message like this:
Cannot navigate to a variable in a navigation expression: (title)

[Updated on: Sat, 10 December 2011 11:47]

Report message to a moderator

Re: How to access to attributes in other classes? [message #763719 is a reply to message #763705] Sat, 10 December 2011 11:52 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

> Sorry for the wrong screenshot! I saw it to late, but now there has to
> be the right one.
>
Not attached to the message.
> I just tried self.PollDataBase->exists(pollDS), but in this case, the
> error message I get was:
> Iterate Expression body type must be boolean (Set
> {self.PollDataBase}->exists(temp1 : PollDataBase | temp1.pollDS))
Of course if its pollDS that you want to test try

self.PollDataBase.pollDS->notEmpty()

Regards

Ed Willink
Re: How to access to attributes in other classes? [message #763722 is a reply to message #763719] Sat, 10 December 2011 12:05 Go to previous messageGo to next message
Forenmailadresse is currently offline ForenmailadresseFriend
Messages: 3
Registered: December 2011
Junior Member
Edward Willink wrote on Sat, 10 December 2011 06:52
Hi

> Sorry for the wrong screenshot! I saw it to late, but now there has to
> be the right one.
>
Not attached to the message.
> I just tried self.PollDataBase->exists(pollDS), but in this case, the
> error message I get was:
> Iterate Expression body type must be boolean (Set
> {self.PollDataBase}->exists(temp1 : PollDataBase | temp1.pollDS))
Of course if its pollDS that you want to test try

self.PollDataBase.pollDS->notEmpty()

Regards

Ed Willink

notEmpty() only implies, that the PollDataBase isn't empty - am I right?

That's not the right solution, because there must be the created dataset in the database, so that title, description and options of the dataset fits the parameters given in the phenomenon "sndCreatePollReq".
In the database itself, there can be a lot of pollDS datasets, with different titles, descriptions and options.

Regards, Stefan

EDIT:
I think, I have the solution:
self.PollDataBase.pollDS->exists(pollDS |
pollDS.title = title and
pollDS.description = description and
pollDS.options = options) and
webPage^sndHandledPollDS()

Thanks for your answers Smile

[Updated on: Sat, 10 December 2011 12:15]

Report message to a moderator

Re: How to access to attributes in other classes? [message #763739 is a reply to message #763722] Sat, 10 December 2011 13:02 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

There are limits to my ability to solve your problem purely by telepathy.

Regards

Ed Willink
> notEmpty() only implies, that the PollDataBase isn't empty - am I right?
>
> That's not the right solution, because there must be the created
> dataset in the database, so that title, description and options of the
> dataset fits the parameters given in the phenomenon "sndCreatePollReq".
> In the database itself, there can be a lot of pollDS datasets, with
> different titles, descriptions and options.
>
> Regards, Stefan
Previous Topic:OCL constraints in Ecore problems view messages
Next Topic:[Announce] Eclipse OCL CORE 4.0.0 (Juno) M4 is now available
Goto Forum:
  


Current Time: Thu Apr 18 23:17:20 GMT 2024

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

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

Back to the top