Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL Invariants on Ecore /EMF
OCL Invariants on Ecore /EMF [message #46450] Wed, 12 December 2007 17:11 Go to next message
Eclipse UserFriend
Originally posted by: gentlemanmann.yahoo.de

Hi all,


I am not sure whether I am right here, but i hope so.

I have used EMF to generate my model and the editor which based on.


Now i want to use the org.eclipse.ocl.ecore Plugin to implement a OCL
constraint validation fucntionality against my model instances.

I have found this Tutorial on Eclipse page
( http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. ocl.doc/tutorials/oclInterpreterTutorial.html)

I think its exactly what i need but the problem ist that i get an
exception by Creating an OCL Environment.

Precisely on the line which the EcoreEnvironmentFactory Instance is passed
to the OCL Interpreter:

I think its a configuration problem or somethink like that. Because the
exception is thrown bevor i do anything in my programm.


----------------------------------------------------------
boolean valid;
OCLExpression<EClassifier> query = null;

try {
// create an OCL instance for Ecore
OCL<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, Constraint, EClass, EObject>
ocl;
ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE); //EXCEPTION

// create an OCL helper object
OCLHelper<EClassifier, ?, ?, Constraint> helper =
ocl.createOCLHelper();

// set the OCL context classifier
helper.setContext(DmePackage.Literals.WRITER);

query = helper.createQuery("...");

.....
valid = true;
} catch (ParserException e) {
// record failure to parse
valid = false;
System.err.println(e.getLocalizedMessage());
}


------------------------------------------------
Exception in thread "main" java.lang.NoSuchMethodError:
org.eclipse.ocl.utilities.impl.UtilitiesPackageImpl.addEType Parameter(Lorg/eclipse/emf/ecore/EClassifier;Ljava/lang/Stri ng;)Lorg/eclipse/emf/ecore/ETypeParameter;
at
org.eclipse.ocl.utilities.impl.UtilitiesPackageImpl.initiali zePackageContents(UtilitiesPackageImpl.java:427)
at
org.eclipse.ocl.utilities.impl.UtilitiesPackageImpl.init(Uti litiesPackageImpl.java:173)
at
org.eclipse.ocl.utilities.UtilitiesPackage.<clinit>(UtilitiesPackage.java:70)
at
org.eclipse.ocl.types.impl.TypesPackageImpl.init(TypesPackag eImpl.java:205)
at org.eclipse.ocl.types.TypesPackage.<clinit>(TypesPackage.java:71)
at
org.eclipse.ocl.expressions.impl.ExpressionsPackageImpl.init (ExpressionsPackageImpl.java:416)
at
org.eclipse.ocl.expressions.ExpressionsPackage.<clinit>(ExpressionsPackage.java:72)
at
org.eclipse.ocl.ecore.EcoreEnvironment.<clinit>(EcoreEnvironment.java:82)
at
org.eclipse.ocl.ecore.EcoreEnvironmentFactory.createEnvironm ent(EcoreEnvironmentFactory.java:83)
at org.eclipse.ocl.OCL.<init>(OCL.java:73)
at org.eclipse.ocl.OCL.newInstance(OCL.java:131)Hallo

at oclValidator.OCLValidator.validate(OCLValidator.java:44)
at oclValidator.OCLValidator.main(OCLValidator.java:107)

best wishes and many thanks

LEE
Re: OCL Invariants on Ecore /EMF [message #46481 is a reply to message #46450] Wed, 12 December 2007 18:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Lee,

You are running with the wrong version of the EMF run-time. From the
exception, it looks like you are using version 2.2 or earlier, which
predates Ecore's support for generic types.

You need EMF 2.3 for OCL 1.1 and EMF 2.4 for OCL 1.2.

Cheers,

Christian


Lee wrote:

> Hi all,
>
>
> I am not sure whether I am right here, but i hope so.
>
> I have used EMF to generate my model and the editor which based on.
>
>
> Now i want to use the org.eclipse.ocl.ecore Plugin to implement a OCL
> constraint validation fucntionality against my model instances.
>
> I have found this Tutorial on Eclipse page
>
( http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. ocl.doc/tutorials/oclInterpreterTutorial.html)
>
> I think its exactly what i need but the problem ist that i get an
> exception by Creating an OCL Environment.
>
> Precisely on the line which the EcoreEnvironmentFactory Instance is passed
> to the OCL Interpreter:
>
> I think its a configuration problem or somethink like that. Because the
> exception is thrown bevor i do anything in my programm.
>
>
> ----------------------------------------------------------
> boolean valid;
> OCLExpression<EClassifier> query = null;
>
> try {
> // create an OCL instance for Ecore
> OCL<?, EClassifier, ?, ?, ?, ?, ?, ?, ?, Constraint, EClass, EObject>
> ocl;
> ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE); //EXCEPTION
>
> // create an OCL helper object
> OCLHelper<EClassifier, ?, ?, Constraint> helper =
> ocl.createOCLHelper();
>
> // set the OCL context classifier
> helper.setContext(DmePackage.Literals.WRITER);
>
> query = helper.createQuery("...");
>
> .....
> valid = true;
> } catch (ParserException e) {
> // record failure to parse
> valid = false;
> System.err.println(e.getLocalizedMessage());
> }
>
>
> ------------------------------------------------
> Exception in thread "main" java.lang.NoSuchMethodError:
>
org.eclipse.ocl.utilities.impl.UtilitiesPackageImpl.addEType Parameter(Lorg/eclipse/emf/ecore/EClassifier;Ljava/lang/Stri ng;)Lorg/eclipse/emf/ecore/ETypeParameter;
> at
>
org.eclipse.ocl.utilities.impl.UtilitiesPackageImpl.initiali zePackageContents(UtilitiesPackageImpl.java:427)
> at
>
org.eclipse.ocl.utilities.impl.UtilitiesPackageImpl.init(Uti litiesPackageImpl.java:173)
> at
>
org.eclipse.ocl.utilities.UtilitiesPackage.<clinit>(UtilitiesPackage.java:70)
> at
>
org.eclipse.ocl.types.impl.TypesPackageImpl.init(TypesPackag eImpl.java:205)
> at org.eclipse.ocl.types.TypesPackage.<clinit>(TypesPackage.java:71)
> at
>
org.eclipse.ocl.expressions.impl.ExpressionsPackageImpl.init (ExpressionsPackageImpl.java:416)
> at
>
org.eclipse.ocl.expressions.ExpressionsPackage.<clinit>(ExpressionsPackage.java:72)
> at
> org.eclipse.ocl.ecore.EcoreEnvironment.<clinit>(EcoreEnvironment.java:82)
> at
>
org.eclipse.ocl.ecore.EcoreEnvironmentFactory.createEnvironm ent(EcoreEnvironmentFactory.java:83)
> at org.eclipse.ocl.OCL.<init>(OCL.java:73)
> at org.eclipse.ocl.OCL.newInstance(OCL.java:131)Hallo
>
> at oclValidator.OCLValidator.validate(OCLValidator.java:44)
> at oclValidator.OCLValidator.main(OCLValidator.java:107)
>
> best wishes and many thanks
>
> LEE
Re: OCL Invariants on Ecore /EMF [message #46510 is a reply to message #46481] Wed, 12 December 2007 19:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gentlemanmann.yahoo.de

Hi,

Damn,

you are right. I am using EMF 2.2.1 because i am obliged to use Eclipse
3.2.

Is there an other framework or Library, which i can use to validate my
(Ecore) model instances in EMF which OCL (Constraints/Invariants)?

Greets and thanks
lee
Re: OCL Invariants on Ecore /EMF [message #46562 is a reply to message #46510] Wed, 12 December 2007 22:13 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Lee,

Well, there is the 1.0.x releases of MDT OCL (a.k.a. EMFT OCL). These will
work with EMF 2.2, but that API is deprecated in the 1.1 and later
releases.

HTH,

Christian

Lee wrote:

> Hi,
>
> Damn,
>
> you are right. I am using EMF 2.2.1 because i am obliged to use Eclipse
> 3.2.
>
> Is there an other framework or Library, which i can use to validate my
> (Ecore) model instances in EMF which OCL (Constraints/Invariants)?
>
> Greets and thanks
> lee
Previous Topic:java.lang.ClassCircularityError: myPackage/ValidationDelegateClientSelector
Next Topic:[Announce] MDT OCL 1.2.0 I200712121716 is available
Goto Forum:
  


Current Time: Sun Nov 23 13:42:17 GMT 2014

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

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