CompleteOCLEObjectValidator and UML meta model [message #792104] |
Mon, 06 February 2012 11:10  |
Eclipse User |
|
|
|
Hello,
I have registered an CompleteOCLEObjectValidator for a sample OCL file with a rule on the UML meta model in the EValidator registry:
OCL file
import 'http[:]//www.eclipse.org/emf/2002/Ecore'
import 'http[:]//www.eclipse.org/emf/2002/GenModel'
import 'http[:]//www.eclipse.org/uml2/3.0.0/UML'
package uml
context Classifier
inv NoInheritanceCycles('There is a cycle in the inheritence, one of the parents of class "'+self.name+'" is the class itself.') :
not self.allParents()->includes(self)
endpackage
plugin.xml
<extension
point="org.eclipse.ui.startup">
<startup
class="org.eclipse.ocl.validation.pivot.example.ExampleValidatorRegistration">
</startup>
</extension>
IStartup implementation
public class ExampleValidatorRegistration implements IStartup {
private static final URI exampleURI = URI.createURI("platform:/plugin/org.eclipse.ocl.validation.pivot.example/constraints/sample.ocl");
@Override
public void earlyStartup() {
UMLPackage _package = UMLPackage.eINSTANCE;
// Register EValidator
EValidator.Registry.INSTANCE.put(
_package,
new CompleteOCLEObjectValidator(_package,exampleURI));
}
}
The evaluation of the query fails during validation. An Exception is thrown during evaluation of the query: org.eclipse.ocl.examples.pivot.InvalidEvaluationException: 'Boolean' value required.
I don't get it, the OCL Console doesn't have a problem with the query. Is this a bug in the CompleteOCLEObjectValidator or do I miss something?
P.S. I am not allowed to post links until I have 5 posts in the forum, so I replaced ":" by "[:]" in the URIs
|
|
|
|
|
|
|
|
Re: CompleteOCLEObjectValidator and UML meta model [message #794087 is a reply to message #793994] |
Wed, 08 February 2012 17:42  |
Eclipse User |
|
|
|
Alright, thanks for taking care of this problem! The Exception with the message "'Boolean' value required" is raised inside of the validator, when query.accept(...) is called. To the outside the message "OCL validation result of ''...'' is invalid" will be shown.
Thanks again,
Max
|
|
|
Powered by
FUDForum. Page generated in 0.05692 seconds