| RoyalandLoyal example [message #868788] |
Wed, 02 May 2012 10:42  |
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 #869956 is a reply to message #869907] |
Sat, 05 May 2012 02:39   |
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 02:42] Report message to a moderator
|
|
|
| Re: RoyalandLoyal example [message #872842 is a reply to message #869956] |
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.
[Updated on: Wed, 16 May 2012 19:35] Report message to a moderator
|
|
|
|
| Re: RoyalandLoyal example [message #874859 is a reply to message #872842] |
Mon, 21 May 2012 13:31   |
|
I'm sorry. I was wrong.
Wing isn't nothing.
I edited my post. look:
Pablo Silva wrote on Wed, 16 May 2012 19:34I 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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01998 seconds