Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsdescribe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/727503/#msg_727503
The question is when I want to describe a class diagram with two classes,
I would like to implement the relation which is "navigation" between these two classes
but it looks like that it doesn't work when I write the OCL which describes both classes in an OCL file.
I have no idea whether it does make sense that the OCL can allow both classes in a same file. --- Problem 1
Besides, in EMF, I want to draw the diagrams which have a 'navigation' relation between classes without arrow. However,the EMF doesn't allow me to do that, i.e. there is still an arrow between two classes. --- Problem 2
Please answer my questions, thanks you a lot
]]>pllab Missing name2011-09-21T13:23:44-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/727554/#msg_727554
I'm not clear what you mean by an OCL file, and it is not clear why you
are using OCL at all for a navigation relationship between two classes.
It might help if you provided an example.
It is also not clear what you mean by drawing diagrams in EMF. EMF
provides XSD, XMI, tree and model representations; no graphics. Do you
mean the Ecore Tools Diagram Editor?
2) Just about any Class Diagram notation can support a directional
navigation, however the graphical presentation options may not always
fully reflect the flexibility of an underlying Ecore or UML model.
1) Yes OCL works fine for multiple classes in one or more files.
Regards
Ed Willink
On 21/09/2011 14:23, pllab wrote:
> Hi,I'm a new user with OCL. And I have met several problems...
>
> The question is when I want to describe a class diagram with two classes,
>
> I would like to implement the relation which is "navigation" between
> these two classes
> but it looks like that it doesn't work when I write the OCL which
> describes both classes in an OCL file.
>
> I have no idea whether it does make sense that the OCL can allow both
> classes in a same file. --- Problem 1
>
> Besides, in EMF, I want to draw the diagrams which have a 'navigation'
> relation between classes without arrow. However,the EMF doesn't allow
> me to do that, i.e. there is still an arrow between two classes. ---
> Problem 2
>
> Please answer my questions, thanks you a lot :d
>]]>Ed Willink2011-09-21T13:57:26-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/727534/#msg_727534
I'm not clear what you mean by an OCL file, and it is not clear why you
are using OCL at all for a navigation relationship between two classes.
It might help if you provided an example.
It is also not clear what you mean by drawing diagrams in EMF. EMF
provides XSD, XMI, tree and model representations; no graphics. Do you
mean the Ecore Tools Diagram Editor?
2) Just about any Class Diagram notation can support a directional
navigation, however the graphical presentation options may not always
fully reflect the flexibility of an underlying Ecore or UML model.
1) Yes OCL works fine for multiple classes in one or more files.
Regards
Ed Willink
On 21/09/2011 14:23, pllab wrote:
> Hi,I'm a new user with OCL. And I have met several problems...
>
> The question is when I want to describe a class diagram with two classes,
>
> I would like to implement the relation which is "navigation" between
> these two classes
> but it looks like that it doesn't work when I write the OCL which
> describes both classes in an OCL file.
>
> I have no idea whether it does make sense that the OCL can allow both
> classes in a same file. --- Problem 1
>
> Besides, in EMF, I want to draw the diagrams which have a 'navigation'
> relation between classes without arrow. However,the EMF doesn't allow
> me to do that, i.e. there is still an arrow between two classes. ---
> Problem 2
>
> Please answer my questions, thanks you a lot :d
>]]>Ed Willink2011-09-21T13:57:26-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/727537/#msg_727537
I'm not clear what you mean by an OCL file, and it is not clear why you
are using OCL at all for a navigation relationship between two classes.
It might help if you provided an example.
It is also not clear what you mean by drawing diagrams in EMF. EMF
provides XSD, XMI, tree and model representations; no graphics. Do you
mean the Ecore Tools Diagram Editor?
2) Just about any Class Diagram notation can support a directional
navigation, however the graphical presentation options may not always
fully reflect the flexibility of an underlying Ecore or UML model.
1) Yes OCL works fine for multiple classes in one or more files.
Regards
Ed Willink
On 21/09/2011 14:23, pllab wrote:
> Hi,I'm a new user with OCL. And I have met several problems...
>
> The question is when I want to describe a class diagram with two classes,
>
> I would like to implement the relation which is "navigation" between
> these two classes
> but it looks like that it doesn't work when I write the OCL which
> describes both classes in an OCL file.
>
> I have no idea whether it does make sense that the OCL can allow both
> classes in a same file. --- Problem 1
>
> Besides, in EMF, I want to draw the diagrams which have a 'navigation'
> relation between classes without arrow. However,the EMF doesn't allow
> me to do that, i.e. there is still an arrow between two classes. ---
> Problem 2
>
> Please answer my questions, thanks you a lot :d
>]]>Ed Willink2011-09-21T13:57:26-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/727810/#msg_727810
I have uploaded the class diagram.
About the first question,I write the OCL which I refer to "OCL file" is as follows:
package motordriver
context Person
inv: age > 0
context Person::Person(a:Integer):
pre: a > 0
post: age = a
context Person::isAdult(): Boolean
post:
if age >= 18 then
result = true
else
result = false
endif
context Motor
inv: displacement >= 50
--context Motor
--inv:self.man.age = 18
context Motor::Motor(d:Integer):
pre: d > 0
post: displacement = d
context Motor::heavyWeight():String
post:
if displacement >= 100 then
result = 'HeavyWeight'
else
if displacement = 50 then
result = 'LightWeight'
else
result = 'Nothing'
endif
endif
endpackage
There are two classes in the diagram, and I describe this diagram via OCL specification. When I want to parse it, it looks like the parser can parse only one class diagram. BTW, the tool I use is ecore modeling framework for eclipse.
]]>pllab Missing name2011-09-22T02:10:23-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/728028/#msg_728028
Ok, you are using 'Complete' OCL, which is really intended for
complementing an existing model rather than defining a model; as you
have noticed the syntax is insufficient for definition. Just enough for
reference.
I would recommend using Ecore directly, or OCLinEcore to define the
model. If you use OCLinEcore then you can embed the OCL and have it
incorporated in generated Java (for interpreted execution in Indigo,
direct Java in Juno).
The OCLinEcore could look like
package motordriver
{
class Person
{
property age : Integer;
property motor#man : Motor[*];
invariant: age > 0;
operation Person(a:Integer)
{
precondition: a > 0;
postcondition: age = a;
}
operation isAdult() : Boolean
{
body:
if age >= 18 then
true
else
false
endif;
}
}
class Motor
{
property displacement : Integer;
property man#motor : Person;
operation heavyWeight() : String
{
body:
if displacement >= 100 then
'HeavyWeight'
else
if displacement = 50 then
'LightWeight'
else
'Nothing'
endif
endif;
}
}
}
On 22/09/2011 03:10, pllab wrote:
> Thanks to your reply, and I'm sorry for my unclear questions.
> I have uploaded the class diagram.
> About the first question,I write the OCL which I refer to "OCL file" is as follows:
>
> package motordriver
>
> context Person
> inv: age> 0
>
> context Person::Person(a:Integer):
> pre: a> 0
> post: age = a
>
> context Person::isAdult(): Boolean
> post:
> if age>= 18 then
> result = true
> else
> result = false
> endif
>
> context Motor
> inv: displacement>= 50
>
> --context Motor
> --inv:self.man.age = 18
> context Motor::Motor(d:Integer):
> pre: d> 0
> post: displacement = d
>
> context Motor::heavyWeight():String
> post:
> if displacement>= 100 then
> result = 'HeavyWeight'
> else
> if displacement = 50 then
> result = 'LightWeight'
> else
> result = 'Nothing'
> endif
> endif
> endpackage
>
> There are two classes in the diagram, and I describe this diagram via OCL specification. When I want to parse it, it looks like the parser can parse only one class diagram. BTW, the tool I use is ecore modeling framework for eclipse.
>]]>Ed Willink2011-09-22T12:10:24-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/728029/#msg_728029
Ok, you are using 'Complete' OCL, which is really intended for
complementing an existing model rather than defining a model; as you
have noticed the syntax is insufficient for definition. Just enough for
reference.
I would recommend using Ecore directly, or OCLinEcore to define the
model. If you use OCLinEcore then you can embed the OCL and have it
incorporated in generated Java (for interpreted execution in Indigo,
direct Java in Juno).
The OCLinEcore could look like
package motordriver
{
class Person
{
property age : Integer;
property motor#man : Motor[*];
invariant: age > 0;
operation Person(a:Integer)
{
precondition: a > 0;
postcondition: age = a;
}
operation isAdult() : Boolean
{
body:
if age >= 18 then
true
else
false
endif;
}
}
class Motor
{
property displacement : Integer;
property man#motor : Person;
operation heavyWeight() : String
{
body:
if displacement >= 100 then
'HeavyWeight'
else
if displacement = 50 then
'LightWeight'
else
'Nothing'
endif
endif;
}
}
}
On 22/09/2011 03:10, pllab wrote:
> Thanks to your reply, and I'm sorry for my unclear questions.
> I have uploaded the class diagram.
> About the first question,I write the OCL which I refer to "OCL file" is as follows:
>
> package motordriver
>
> context Person
> inv: age> 0
>
> context Person::Person(a:Integer):
> pre: a> 0
> post: age = a
>
> context Person::isAdult(): Boolean
> post:
> if age>= 18 then
> result = true
> else
> result = false
> endif
>
> context Motor
> inv: displacement>= 50
>
> --context Motor
> --inv:self.man.age = 18
> context Motor::Motor(d:Integer):
> pre: d> 0
> post: displacement = d
>
> context Motor::heavyWeight():String
> post:
> if displacement>= 100 then
> result = 'HeavyWeight'
> else
> if displacement = 50 then
> result = 'LightWeight'
> else
> result = 'Nothing'
> endif
> endif
> endpackage
>
> There are two classes in the diagram, and I describe this diagram via OCL specification. When I want to parse it, it looks like the parser can parse only one class diagram. BTW, the tool I use is ecore modeling framework for eclipse.
>]]>Ed Willink2011-09-22T12:10:24-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/728846/#msg_728846
I do not understand what did you mean in the first paragraph.
I'm now using ecore model to describe the example what I want to implement.
And after that, I have to write OCL manually to support that ecore model.
But the methods what I use is required by my teacher.
I try to figure out the question that I have mentioned before. Is it possible to implement navigationCallExp in OCL by the methods what I use now?
My work is going to do software testing by using both ecore model and OCL.
And using ECLiPSe to verify the correctness with that model.
The information what I reference is as follow:
download.eclipse.org/modeling/mdt/ocl/javadoc/3.0.0/org/eclipse/ocl/ecore/package-summary.html
If there is anything you don't know what I say, I'll explain it clearly again.
Thanks for your help!!
]]>pllab Missing name2011-09-24T03:34:55-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/728862/#msg_728862
Very little of what you write makes any sense to me at all.
navigationCallExp is a mechanism in OCL why would you want to implement
what the tool implements?
Either you have misunderstood your teacher or your teacher is very
misguided.
You do not understand my first paragraph, which you do not quote, I
presume it is the sentence about Complete OCL. I suggest you read the
OCL specification or Google some of my papers to find out about Complete
OCL wrt Essential OCL. The Javadocs should be completely irrelevant to
your use of OCL. Do you read the class documentation in order to use an
email tool?
You will eventually find evidence that a bidirectional relationship
cannot be defined in Complete OCL, which may form part of your class
answer and justify your use of a solution that actually works.
Regards
Ed Willink
On 24/09/2011 04:34, pllab wrote:
> Hello! Very appreciate for your advice.
>
> I do not understand what did you mean in the first paragraph.
> I'm now using ecore model to describe the example what I want to
> implement.
> And after that, I have to write OCL manually to support that ecore model.
>
> But the methods what I use is required by my teacher.
> I try to figure out the question that I have mentioned before.
> Is it possible to implement navigationCallExp in OCL by the methods
> what I use now?
> My work is going to do software testing by using both ecore model and
> OCL.
> And using ECLiPSe to verify the correctness with that model.
> The information what I reference is as follow:
> download.eclipse.org/modeling/mdt/ocl/javadoc/3.0.0/org/eclipse/ocl/ecore/package-summary.html
>
>
> If there is anything you don't know what I say, I'll explain it
> clearly again.
> Thanks for your help!!
>]]>Ed Willink2011-09-24T05:18:28-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/735381/#msg_735381
my work is going to load an ecore file and ocl file to generate test data
before generating the test data successfully,I need a complete specification
so I have to use both files to fulfill my implementation.
The reason why I have to "implement" the NavigationCallExp is as follow:
When I load the files I have mentioned before, the parser need to parse the file(xmi)
And so that I can build an OCL expression tree, and also, to get the information that which OCL expression has shown in the OCL file.
By the way, I have used oclInEcore that you suggested.
But how can I get the ocl file when I use oclInecore editor to edit the ecore project?
There is only an ecore file without ocl file.
Do I have to erase the function to load the ocl file?
]]>pllab Missing name2011-10-11T16:02:32-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/735407/#msg_735407
I've been thinking about Ecore/OCL merge tooling. What you imply seems
more useful; https://bugs.eclipse.org/bugs/show_bug.cgi?id=360567
raised. I'm afraid that doesn't help you now.
If you want to extract the OCL from an OCLinEcore file, it's probably
easiest to cut and paste for now. But do you really need separate files?
Regards
Ed Willink
On 11/10/2011 17:02, pllab wrote:
> hi
> my work is going to load an ecore file and ocl file to generate test data
> before generating the test data successfully,I need a complete
> specification
> so I have to use both files to fulfill my implementation.
>
> The reason why I have to "implement" the NavigationCallExp is as follow:
> When I load the files I have mentioned before, the parser need to
> parse the file(xmi)
> And so that I can build an OCL expression tree, and also, to get the
> information that which OCL expression has shown in the OCL file.
>
> By the way, I have used oclInEcore that you suggested.
> But how can I get the ocl file when I use oclInecore editor to edit
> the ecore project?
> There is only an ecore file without ocl file.
> Do I have to erase the function to load the ocl file?
>
>]]>Ed Willink2011-10-11T17:18:33-00:00Re: describe mutiple classes as OCL
https://www.eclipse.org/forums/index.php/mv/msg/241187/735408/#msg_735408
I've been thinking about Ecore/OCL merge tooling. What you imply seems
more useful; https://bugs.eclipse.org/bugs/show_bug.cgi?id=360567
raised. I'm afraid that doesn't help you now.
If you want to extract the OCL from an OCLinEcore file, it's probably
easiest to cut and paste for now. But do you really need separate files?
Regards
Ed Willink
On 11/10/2011 17:02, pllab wrote:
> hi
> my work is going to load an ecore file and ocl file to generate test data
> before generating the test data successfully,I need a complete
> specification
> so I have to use both files to fulfill my implementation.
>
> The reason why I have to "implement" the NavigationCallExp is as follow:
> When I load the files I have mentioned before, the parser need to
> parse the file(xmi)
> And so that I can build an OCL expression tree, and also, to get the
> information that which OCL expression has shown in the OCL file.
>
> By the way, I have used oclInEcore that you suggested.
> But how can I get the ocl file when I use oclInecore editor to edit
> the ecore project?
> There is only an ecore file without ocl file.
> Do I have to erase the function to load the ocl file?
>
>]]>Ed Willink2011-10-11T17:18:33-00:00