Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Implement method in ecore
Implement method in ecore [message #1834052] Sat, 31 October 2020 10:20 Go to next message
Tijana Lalošević is currently offline Tijana LaloševićFriend
Messages: 2
Registered: October 2020
Junior Member
Hi everyone,

I asked before few days on StackOverflow this question, how-to-validate-java-util-date-attribute-in-ocl and got an answer, but I have a problem to use implemented method from a {class}Impl in ecore invariant.

My steps:
1. I add new class EDateHalper with some operation and add a reference to root class
2. Generate genmodel and model
3. Implement this operation in EDateHelperImpl
4. Try to use this method in ecore invariant, but I got this message when I try to validate my model "An exception occurred while delegation evaluation of the constraint" etc, this is a stacktrace:

org.eclipse.ocl.common.internal.delegate.OCLDelegateException: OCL validation result of 'Approval::Test' is invalid for 'Class Approval'
at org.eclipse.ocl.examples.pivot.delegate.OCLValidationDelegate.validateExpressionInOCL(OCLValidationDelegate.java:293)
at org.eclipse.ocl.examples.pivot.delegate.OCLValidationDelegate.validatePivot(OCLValidationDelegate.java:237)
at org.eclipse.ocl.examples.pivot.delegate.OCLValidationDelegate.validate(OCLValidationDelegate.java:188)
at org.eclipse.ocl.examples.pivot.delegate.OCLValidationDelegateFactory.validate(OCLValidationDelegateFactory.java:80)
at org.eclipse.emf.ecore.util.EObjectValidator.validate(EObjectValidator.java:227)
at org.eclipse.emf.ecore.util.EObjectValidator$DynamicEClassValidator.validateDelegatedConstraints(EObjectValidator.java:1403)
at org.eclipse.emf.ecore.util.EObjectValidator$DynamicEClassValidator.validate(EObjectValidator.java:1420)
at org.eclipse.emf.ecore.util.EObjectValidator.validate(EObjectValidator.java:333)
at org.eclipse.emf.ecore.util.Diagnostician.doValidate(Diagnostician.java:299)
at org.eclipse.emf.edit.ui.action.ValidateAction$3.doValidate(ValidateAction.java:342)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:245)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:200)
at org.eclipse.emf.edit.ui.action.ValidateAction.validate(ValidateAction.java:292)
at org.eclipse.emf.edit.ui.action.ValidateAction$1.run(ValidateAction.java:177)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: org.eclipse.ocl.examples.domain.values.impl.InvalidValueException: Failed to evaluate privacymodel::Approval.startDate
at org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl.visitPropertyCallExp(EvaluationVisitorImpl.java:786)
at org.eclipse.ocl.examples.pivot.internal.impl.PropertyCallExpImpl.accept(PropertyCallExpImpl.java:391)
at org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl.evaluate(EvaluationVisitorImpl.java:145)
at org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl.visitOperationCallExp(EvaluationVisitorImpl.java:720)
at org.eclipse.ocl.examples.pivot.internal.impl.OperationCallExpImpl.accept(OperationCallExpImpl.java:447)
at org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl.safeVisit(EvaluationVisitorImpl.java:171)
at org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl.visitExpressionInOCL(EvaluationVisitorImpl.java:390)
at org.eclipse.ocl.examples.pivot.internal.impl.ExpressionInOCLImpl.accept(ExpressionInOCLImpl.java:655)
at org.eclipse.ocl.examples.pivot.delegate.OCLValidationDelegate.validateExpressionInOCL(OCLValidationDelegate.java:275)
... 14 more
Caused by: java.lang.UnsupportedOperationException
at org.eclipse.ocl.examples.library.executor.AbstractIdResolver.boxedValueOf(AbstractIdResolver.java:204)
at org.eclipse.ocl.examples.library.executor.AbstractIdResolver.boxedValueOf(AbstractIdResolver.java:219)
at org.eclipse.ocl.examples.library.executor.AbstractIdResolver.boxedValueOf(AbstractIdResolver.java:239)
at org.eclipse.ocl.examples.pivot.library.ExplicitNavigationProperty.evaluate(ExplicitNavigationProperty.java:67)
at org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl.visitPropertyCallExp(EvaluationVisitorImpl.java:778)
... 22 more
Re: Implement method in ecore [message #1834066 is a reply to message #1834052] Sat, 31 October 2020 22:43 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7107
Registered: July 2009
Senior Member
Hi

OCL questions should be asked on the OCL forum.

It seems you have written some code that doesn't work. Difficult to comment without seeing the code as part of an executable repro.

Regards

Ed Willink
Re: Implement method in ecore [message #1834068 is a reply to message #1834066] Sun, 01 November 2020 09:48 Go to previous messageGo to next message
Tijana Lalošević is currently offline Tijana LaloševićFriend
Messages: 2
Registered: October 2020
Junior Member

Can you leave me your email? I could make some dummy project where I would reproduce the problem, so take a look.
Re: Implement method in ecore [message #1834074 is a reply to message #1834068] Sun, 01 November 2020 18:30 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7107
Registered: July 2009
Senior Member
Hi

A dummy project can be attached to a forum reply, or shared via a DropBox link, or a GitHub repo.

Private communication is for confidential sharing of a real project to facilitate debugging an Eclipse project, not the user's code.

Regards

Ed Willink

[Updated on: Sun, 01 November 2020 18:34]

Report message to a moderator

Previous Topic:[CD0] Read lock owners not being cleared after closing view
Next Topic:Loading UML Model with model library in standalone
Goto Forum:
  


Current Time: Fri Apr 23 03:13:22 GMT 2021

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

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

Back to the top