Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » RoyalandLoyal example
RoyalandLoyal example [message #868788] Wed, 02 May 2012 14:42 Go to next message
Lucy Chan is currently offline Lucy Chan
Messages: 29
Registered: March 2012
Junior Member
In the RoyalandLoyal example, there is RoyalandLoyal.ocl file. I just want to know what tools or button/menu I should use to generate my xx.ocl file to validate the ecore model.
Thanks sincerely!
Re: RoyalandLoyal example [message #868833 is a reply to message #868788] Wed, 02 May 2012 15:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4093
Registered: July 2009
Senior Member
Hi

If you've installed the OCL Examples and Editors, you just do New File
something.ocl and it will use the Complete OCL editor.

To use it for validation, use the Load Complete OCL REesource menu
option (Juno M6 onwards) to load it into your modeling tool. Prior to
Juno M6 you must write some Java.

Regards

Ed Willink



On 02/05/2012 15:42, Lucy Chan wrote:
> In the RoyalandLoyal example, there is RoyalandLoyal.ocl file. I just
> want to know what tools or button/menu I should use to generate my
> xx.ocl file to validate the ecore model.
> Thanks sincerely!
Re: RoyalandLoyal example [message #869743 is a reply to message #868833] Fri, 04 May 2012 07:24 Go to previous messageGo to next message
Lucy Chan is currently offline Lucy Chan
Messages: 29
Registered: March 2012
Junior Member
Is the OCL expression should be embedded into the xx.ecore file opened with xtext. In this way, the constraints will be validated. But how can we use the xx.ocl file to validate our ecore model?
Thanks for your reply.
Re: RoyalandLoyal example [message #869816 is a reply to message #869743] Fri, 04 May 2012 11:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4093
Registered: July 2009
Senior Member
Hi

My previous replay contained the answer.

"To use it for validation, use the Load Complete OCL REesource menu
option (Juno M6 onwards) to load it into your modeling tool. Prior to
Juno M6 you must write some Java. "

Regards

Ed Willink

On 04/05/2012 08:24, Lucy Chan wrote:
> Is the OCL expression should be embedded into the xx.ecore file opened
> with xtext. In this way, the constraints will be validated. But how
> can we use the xx.ocl file to validate our ecore model?
> Thanks for your reply.
Re: RoyalandLoyal example [message #869881 is a reply to message #869816] Fri, 04 May 2012 15:50 Go to previous messageGo to next message
Lucy Chan is currently offline Lucy Chan
Messages: 29
Registered: March 2012
Junior Member
It seems that I need an OCL compile. But I think I have installed it by installing OCL examples and editors, and OCL END USER SDK. Is it right?
Re: RoyalandLoyal example [message #869907 is a reply to message #869881] Fri, 04 May 2012 17:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4093
Registered: July 2009
Senior Member
Hi

There is no OCL compiler. OCL execution is interpreted.

[Juno introduces an OCL to Java capability within genmodel, so that you
can then use the Java compiler for improved speed.]

If you have installed the Juno M6 OCL Examples and Editors, without
error, then you have everything necessary.

Regards

Ed Willink

On 04/05/2012 16:50, Lucy Chan wrote:
> It seems that I need an OCL compile. But I think I have installed it
> by installing OCL examples and editors, and OCL END USER SDK. Is it
> right?
Re: RoyalandLoyal example [message #869956 is a reply to message #869907] Sat, 05 May 2012 06:39 Go to previous messageGo to next message
Lucy Chan is currently offline Lucy Chan
Messages: 29
Registered: March 2012
Junior Member
The following shows the code example how we can parse xx.ocl file. I think it just you suggested me before to write some java prior.
I want to modify the codes in the ocl document guide. But some words puzzled. The notation denotes that "get an OCL text file via some hypothetical API", I just wonder what API should I use. Can you give some reference?
The eclipse reminds me to create getWorkspaceFile class. If there is any code already I can use?
Thanks

--------------------------------------------------------------------------------
OCL<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, Constraint, EClass, EObject> ocl;
ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE);

// get an OCL text file via some hypothetical API
IFile file = getWorkspaceFile("/ocl/constraints.ocl");

InputStream in = file.getContents();

Map<String, Constraint> constraintMap = new HashMap<String, Constraint>();

// parse the contents as an OCL document
try {
OCLInput document = new OCLInput(in, file.getCharset());

List<Constraint> constraints = ocl.parse(input);
for (Constraint next : constraints) {
constraintMap.put(next.getName(), next);

OCLExpression<EClassifier> body = next.getSpecification().getBodyExpression();
System.out.printf("%s: %s%n", next.getName(), body);
}
} finally {
in.close();
}

[Updated on: Sat, 05 May 2012 06:42]

Report message to a moderator

Re: RoyalandLoyal example [message #872842 is a reply to message #869956] Wed, 16 May 2012 23:34 Go to previous messageGo to next message
Pablo Silva is currently offline Pablo Silva
Messages: 28
Registered: May 2012
Location: Brazil
Junior Member

I would also like to know about it. Where I have to go to install the Juno M6 OCL Examples and Editors and also wonder if when creating the file xx.ocl and create restrictions on even if you need to integrate this file xx.ocl to my Ecore Metamodel and if so how?

Thank's.

[Updated on: Wed, 16 May 2012 23:35]

Report message to a moderator

Re: RoyalandLoyal example [message #873179 is a reply to message #872842] Thu, 17 May 2012 16:25 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4093
Registered: July 2009
Senior Member
Hi

What is a "wing"?

See my other answer.

Regards

Ed Willink

On 17/05/2012 00:34, Pablo Silva wrote:
> I would also like to know about it. Where I have to go to install the
> wing and also wonder if when creating the file xx.ocl and create
> restrictions on even if you need to integrate this file xx.ocl to my
> Ecore Metamodel and if so how?
>
> Thank's.
Re: RoyalandLoyal example [message #874859 is a reply to message #872842] Mon, 21 May 2012 17:31 Go to previous messageGo to next message
Pablo Silva is currently offline Pablo Silva
Messages: 28
Registered: May 2012
Location: Brazil
Junior Member

I'm sorry. I was wrong.
Wing isn't nothing.

I edited my post. look:

Pablo Silva wrote on Wed, 16 May 2012 19:34
I would also like to know about it. Where I have to go to install the Juno M6 OCL Examples and Editors and also wonder if when creating the file xx.ocl and create restrictions on even if you need to integrate this file xx.ocl to my Ecore Metamodel and if so how?

Thank's.


I even don't understand how to integrate my Ecore and my xx.ocl file.
If you can explain to me, I appreciate.

Thank's
Re: RoyalandLoyal example [message #874903 is a reply to message #874859] Mon, 21 May 2012 19:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4093
Registered: July 2009
Senior Member
Hi

Try following the OCLinEcore tutorial.

Regards

Ed Willink

On 21/05/2012 18:31, Pablo Silva wrote:
> I'm sorry. I was wrong.
> Wing isn't nothing.
>
> I edited my post. look:
>
> Pablo Silva wrote on Wed, 16 May 2012 19:34
>> I would also like to know about it. Where I have to go to install the
>> Juno M6 OCL Examples and Editors and also wonder if when creating the
>> file xx.ocl and create restrictions on even if you need to integrate
>> this file xx.ocl to my Ecore Metamodel and if so how?
>>
>> Thank's.
>
>
> I even don't understand how to integrate my Ecore and my xx.ocl file.
> If you can explain to me, I appreciate.
>
> Thank's
Re: RoyalandLoyal example [message #875960 is a reply to message #874903] Wed, 23 May 2012 16:13 Go to previous message
Pablo Silva is currently offline Pablo Silva
Messages: 28
Registered: May 2012
Location: Brazil
Junior Member

Thank's for the help!
Previous Topic:[Announce] Eclipse OCL 4.0.0 (Juno) RC1 is now available
Next Topic:OCL as an "object reference graph"
Goto Forum:
  


Current Time: Thu Oct 23 02:27:24 GMT 2014

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

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