Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » using OCL with other modelling tools
using OCL with other modelling tools [message #4775] Tue, 29 November 2005 10:51 Go to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi,

Is it possible to use OCL in EMFT project with other modelling frameworks
which are
- EMF compliant
- or MOF compliant.

If yes. Is there any document available which tells how to use this.

I looked at documents available with gmf help but could not find this info.

Thanks in advance.

~Asha
Re: using OCL with other modelling tools [message #4844 is a reply to message #4775] Tue, 29 November 2005 13:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

Yes, you certainly can use the OCL interpreter with any EMF-implemented
metamodel. There are two "modes" in which it can be used:

- to constrain/query models (instances of your EMF metamodel)
- to include constraints in your models (constraining run-time systems)

The first mode is just a straight-forward application of the IOclHelper API
with the EcoreEnvironment.

The second mode is the case where your EMF metamodel is, itself, a metamodel
for describing software systems or data. The org.eclipse.uml2 API falls
into this category, being an EMF-based metamodel for describing software or
data (as Ecore is). For such applications, you need to provide your own
implementation of the Environment API (via a custom EnvironmentFactory)
that maps your metamodel types to corresponding Ecore types (as Ecore is
the interpreter's "language").

Also, it should be feasible to use the Environment API to map any Java model
(not necessarily EMF-based) to Ecore to work with OCL. This is untried.

There is precious little documentation for any of this. Your best bet is to
see how some of the unit tests make use of the IOclHelper, Environment, and
EnvironmentFactory interfaces.

HTH,

Christian


Asha wrote:

> Hi,
>
> Is it possible to use OCL in EMFT project with other modelling frameworks
> which are
> - EMF compliant
> - or MOF compliant.
>
> If yes. Is there any document available which tells how to use this.
>
> I looked at documents available with gmf help but could not find this
> info.
>
> Thanks in advance.
>
> ~Asha
Re: using OCL with other modelling tools [message #5118 is a reply to message #4844] Thu, 01 December 2005 12:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi,

We would like to know about the licensing policy about usage of EMFT
subproject.

We are building modelling framework. Can we distribute the EMFT
deliverables as part of out tool?

Where can we find details of licensing policy.

Thanks in advance,
Asha
Re: using OCL with other modelling tools [message #5188 is a reply to message #5118] Thu, 01 December 2005 12:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------070202020206030206080809
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Asha,

EMFT, like everything else at Eclipse, is made available via the Eclipse
Public License. Any question you might have about EPL is the same for
all projects.

http://www.eclipse.org/legal/

You can check out the long decisions about EPL in the foundation
newsgroup.

My understanding is that yes, you can redistribute anything you want fee
of charge.


Asha wrote:

> Hi,
>
> We would like to know about the licensing policy about usage of EMFT
> subproject.
> We are building modelling framework. Can we distribute the EMFT
> deliverables as part of out tool?
>
> Where can we find details of licensing policy.
>
> Thanks in advance,
> Asha



--------------070202020206030206080809
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Asha,<br>
<br>
EMFT, like everything else at Eclipse, is made available via the
Eclipse
Public License.
Re: using OCL with other modelling tools [message #5254 is a reply to message #5188] Wed, 07 December 2005 07:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi Ed,

Thanks for the information. I want to download emft project as I need to
reuse OCL implementation.

I tried to connect to CVS repository as per the instruction available at
http://eclipse.org/emf/docs.php?doc=docs/cvsdoc/emfcvsug.htm l

But could not success. It seems access is blocked due to security
constraint ( firewalls ) in our organisation.

I could see the code through viewcvs link , but there are so many files.
Its very time consuming to download file by file through this link.

Can you pl suggest if there is any other alternative to download this
project.

Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #5321 is a reply to message #5254] Wed, 07 December 2005 13:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Asha,

We are making good progress on setting up the builds so hopefully we'll
have packaged builds available within another week.


Asha wrote:

> Hi Ed,
>
> Thanks for the information. I want to download emft project as I need
> to reuse OCL implementation.
>
> I tried to connect to CVS repository as per the instruction available
> at http://eclipse.org/emf/docs.php?doc=docs/cvsdoc/emfcvsug.htm l
>
> But could not success. It seems access is blocked due to security
> constraint ( firewalls ) in our organisation.
>
> I could see the code through viewcvs link , but there are so many
> files. Its very time consuming to download file by file through this
> link.
>
> Can you pl suggest if there is any other alternative to download this
> project.
>
> Thanks and Regards,
> Asha.
>
Re: using OCL with other modelling tools [message #5375 is a reply to message #5321] Fri, 09 December 2005 12:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi,

We have implemented EMF ecore interfaces so that we can have a choice of
storage for models. This way we could reuse EMF's XMI with our tools.
Our implmentation of EMF interfaces is reflective. We don't generate code
for differant meta models.

Same implementation works for any metamodel.

Is it possible to use OCL project in above manner as well ?
Is OCL implementation understands EMF model?

I went through the org.eclipse.emft.tests . But could not get the handle
on how to start?

In order to execute any ocl query / expression on a model how to start
with. Where to use OCLExpression , IOCLHelper , Query is not clear.

Query has evaluate which accepts Object , But just with object how does it
know about fetching othere details about models? How does OCL classes
queries models of EMF?

Please correct me if my interpretation are wrong.

Thanks,
Asha.
Re: using OCL with other modelling tools [message #7314 is a reply to message #5375] Fri, 09 December 2005 17:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

See some responses in-line, below.

Christian


Asha wrote:

> Hi,
>
> We have implemented EMF ecore interfaces so that we can have a choice of
> storage for models. This way we could reuse EMF's XMI with our tools.
> Our implmentation of EMF interfaces is reflective. We don't generate code
> for differant meta models.
>
> Same implementation works for any metamodel.
>
> Is it possible to use OCL project in above manner as well ?
> Is OCL implementation understands EMF model?

Yes. The OCL interpreter's metamodel is Ecore. The context type of any OCL
expression is an EClassifier, and the evaluation of expressions is
performed on instances of EClassifiers (which may be EObjects or, in the
case where the context is an EDataType, any Java object).


> I went through the org.eclipse.emft.tests . But could not get the handle
> on how to start?

The best thing to do is to install the OCL Interpreter example
(org.eclipse.emf.ocl.examples.interpreter) from the EMFT OCL Examples
feature. Once you have done that, you can right-click in an EXTLibrary
editor (for *.extlibrary resources using the "extended library" example
metamodel of EMF) to open the OCL Interpreter console. This console lets
you enter arbitrary OCL expressions and evaluate them (just press the Enter
key).

Look inside the example's code to see how it uses the IOCLHelper interface
to parse and evaluate expressions.


> In order to execute any ocl query / expression on a model how to start
> with. Where to use OCLExpression , IOCLHelper , Query is not clear.

The IOCLHelper interface is your primary point of contact for OCL services.
It parses expressions, evaluates them, and provides content-assist the
capability for editors. The result of parsing an expression is an
OCLExpression object, which is really only interesting if you want to
evaluate it (externally of the helper) or attach it to some EMF resource.
The Query interface is used internally by the IOCLHelper API, and would
only really be useful if you need to parse the full specification of OCL
constraints including package, classifier, and operation contexts (such as
if you were bulk-loading constraints from a text file into your
application).


> Query has evaluate which accepts Object , But just with object how does it
> know about fetching othere details about models? How does OCL classes
> queries models of EMF?

For evaluating constraints, the IOCLHelper is more "friendly" than the Query
API. In both cases, however, the Object that you pass as the evaluation
context is an instance of the context type of an OCLExpression. The
OCLExpression has already stored all the information required for
traversing the references between objects, accessing their attributes, etc.
The major advantage of the IOCLHelper over the Query interface for
evaluating expressions is that it has better support for the allInstances()
operation. The IOCLHelper knows how to efficiently find all of the
instances of an EClass in your Resource, whereas the Query requires you to
provide a mapping of EClasses to extents. The OCL Interpreter example also
demonstrates this capability.

>
> Please correct me if my interpretation are wrong.
>
> Thanks,
> Asha.
Re: using OCL with other modelling tools [message #7379 is a reply to message #7314] Thu, 15 December 2005 13:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi ,

Thanks for the detailed reply. There are few more queries.

After going through the example we could understand that
we can have our own resourceFactory and register Meta package with this as
follows , so that we can control creation of resource through.

Please verify our understanding
===============================
//one time initialization
ResourceSet rset = new ResourceSetImpl();

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "ecore",
new SpeciatizedResourceFactoryImpl() );

Resource res = rset.getResource(URI.createURI("uriOfOurMetaPackage"),
true);


//during evaluation

EClass x; // this will point to our implementation.
IOclHelper helper = HelperUtil.createOclHelper();
helper.setContext(x);

String expr = "some ocl expression to be evaluated";
EObject y ; //object on which OCL expression to be evaluated ???please
check
helper.evaluate(y , expr)


Through resource hook we can supply our specific ecore implementation to
OCL implementation.

some doubts
===========
1) But we couldn't get which emf api is used by ocl implementation to get
instances of a particular classifier through resource so that we can
extend this method.

Does it refer to getContents and filter out classifier specific instances
? But it would be very costly ...

2) Why ResourceSet is used in example. Is there any special reason for
this.

3) Before evaluation how to check whether OCL expression is valid (
according to meta model ) , compiling etc. Does Helper has any api for
this.. if yes how to use it.

4) Hepler has createPrecondition , createPOstcondition ,
createBodyCondition , createInvarient... are we suppose to use these hooks?


Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #7424 is a reply to message #4775] Fri, 16 December 2005 14:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hein..fokus.fraunhofer

Hi Asha,

Perhaps you are interrested in another EMF OCL Tool. It's called OSLO
and it's based on the Kent OCL Library. You can find it at
http://oslo-project.berlios.de


Best regards,
Christian


Asha schrieb:
> Hi,
>
> Is it possible to use OCL in EMFT project with other modelling
> frameworks which are - EMF compliant - or MOF compliant.
>
> If yes. Is there any document available which tells how to use this.
>
> I looked at documents available with gmf help but could not find this info.
>
> Thanks in advance.
>
> ~Asha
>
>
Re: using OCL with other modelling tools [message #7435 is a reply to message #7379] Wed, 21 December 2005 23:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

I don't understand what you are attempting to do by using a specialized
resource implementation to load Ecore models. That has nothing to do with
the OCL parser.

If you use the IOclHelper with the default EcoreEnvironmentFactory, then the
OCL parser can find any classifier in your EPackage by navigating from the
context classifier that you specify (in your example below this is 'x').

So, in response to your question (1): why would the OCL implementation need
to access your Ecore resource? The EClass x that you specified knows its
EPackage, and the OCL implementation just asks the EPackage for a
classifier by name when it needs to look it up (using the
EPackage::getEClassifier(String name) method).

Regarding question (2): I don't know what example you are talking about
that uses a ResourceSet to load an Ecore resource. None of the examples in
the EMFT project does this, as it doesn't make sense.

In answer to (3): The IOclHelper has a createInvariant(String) method (as
well as createPrecondition(String), etc. for operation constraints) that
"compiles" the OCL expression as an OclExpression object. We have a
bugzilla (https://bugs.eclipse.org/bugs/show_bug.cgi?id=114921) requesting
to add support for evaluating a pre-compiled OCL expression. Regarding
validation of an OCL expression, the evaluate() method already does this
implicitly in parsing it, and throws an exception if the expression is
invalid. The createInvariant() and related methods do the same.

In answer to (4): These parsing methods will become more useful when the
bugzilla above is fixed, to pre-compile expressions for later or repeated
evaluation. However, they are already useful for other purposes such as
analyzing them via a Visitor (the OclExpression is an abstract syntax
tree).

I recommend having a look at the boolean evaluate(String expression) method
of the OclConsolePage class in the org.eclipse.emf.ocl.examples.interpreter
example plug-in. It shows how the currently selected object ('context') is
used as the context object when evaluating the OCL expression supplied by
the user in the console. The IOclHelper accepts either an object or its
EClassifier as the context (via the setContext() method) when using the
EcoreEnvironmentFactory. The 'context' object is again used in evaluating
the expression to assign it to the 'self' variable in the OCL expression.

HTH,

Christian


Asha wrote:

> Hi ,
>
> Thanks for the detailed reply. There are few more queries.
>
> After going through the example we could understand that
> we can have our own resourceFactory and register Meta package with this as
> follows , so that we can control creation of resource through.
>
> Please verify our understanding
> ===============================
> //one time initialization
> ResourceSet rset = new ResourceSetImpl();
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "ecore",
> new SpeciatizedResourceFactoryImpl() );
>
> Resource res = rset.getResource(URI.createURI("uriOfOurMetaPackage"),
> true);
>
>
> //during evaluation
>
> EClass x; // this will point to our implementation.
> IOclHelper helper = HelperUtil.createOclHelper();
> helper.setContext(x);
>
> String expr = "some ocl expression to be evaluated";
> EObject y ; //object on which OCL expression to be evaluated ???please
> check
> helper.evaluate(y , expr)
>
>
> Through resource hook we can supply our specific ecore implementation to
> OCL implementation.
>
> some doubts
> ===========
> 1) But we couldn't get which emf api is used by ocl implementation to get
> instances of a particular classifier through resource so that we can
> extend this method.
>
> Does it refer to getContents and filter out classifier specific instances
> ? But it would be very costly ...
>
> 2) Why ResourceSet is used in example. Is there any special reason for
> this.
>
> 3) Before evaluation how to check whether OCL expression is valid (
> according to meta model ) , compiling etc. Does Helper has any api for
> this.. if yes how to use it.
>
> 4) Hepler has createPrecondition , createPOstcondition ,
> createBodyCondition , createInvarient... are we suppose to use these
> hooks?
>
>
> Thanks and Regards,
> Asha.
Re: using OCL with other modelling tools [message #7446 is a reply to message #7379] Thu, 22 December 2005 14:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

I have just committed Bug 114921 which adds to the IOclHelper API the
ability to evaluate or check an expression that has already been parsed (as
an OclExpression).

So, now you check compile and check the validity of a constraint using
IOclHelper::createInvariant(String expression) and, if you succeed in
getting an OclExpression, can check any number of objects for conformance
to that constraint using IOclHelper::check(Object context, OclExpression
constraint).

Cheers,

Christian


Asha wrote:

> Hi ,
>
> Thanks for the detailed reply. There are few more queries.
>

<snip>

> 3) Before evaluation how to check whether OCL expression is valid (
> according to meta model ) , compiling etc. Does Helper has any api for
> this.. if yes how to use it.

<snip>
Re: using OCL with other modelling tools [message #7479 is a reply to message #7435] Tue, 27 December 2005 12:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi Christian,

Basically we want to have our own implementation of EMF Ecore interfaces
as we store models in our own form. We want to use OCL tool which works
with our EMF implementation.

So how do we hook our EMF implementation so that we can use OCL tool.

We used EMF's XMI tool successfully by specialising and extending
appropriate Resource and Factory and Helper implementation.

We are looking for similar kind of hooks in OCL tool as well.

Thanks,
Asha.
Re: using OCL with other modelling tools [message #7490 is a reply to message #7479] Tue, 27 December 2005 14:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: info.dfm2html.com

> Basically we want to have our own implementation of EMF Ecore interfaces
> as we store models in our own form. We want to use OCL tool which works
> with our EMF implementation.

Why do you not define your meta model with Ecore itself, like it is done
for the UML2 meta model, instead of modifying Ecore somehow?

> as we store models in our own form.
I think the persistence is independent of your problem.
E.g. the OCL expressions are parsed with ANTLR and the generated AST is an
Ecore model,
and later is persisted in OCL syntax.

Does anyone know by the way how to generate an editor for OCL expressions?
I imported org.eclipse.emf.ocl as source project, opened model/ocl.genmodel,
but all the menu items like "Generate Editor Code" are disabled.
Re: using OCL with other modelling tools [message #7501 is a reply to message #7479] Wed, 28 December 2005 04:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi ,

Basically we want to have our own implementation of EMF Ecore interfaces
as we store models in our own form. We want to use OCL tool which works
with our EMF implementation. So how do we hook our EMF implementation so
that we can use OCL tool. We used EMF's XMI tool successfully by
specialising and extending appropriate Resource and Factory and Helper
implementation. We are looking for similar kind of hooks in OCL tool as
well.

One Clarification to the above.
-------------------------------
We are storing our meta models and models in database. So have our own
implementation of EMF ecore interfaces which access the model from
database.

For OCL Meta model we are not going to use our specialisation
implementation. The deault ecore implementation in fine with us.

Please tell if this is possible , if yes how to do this.

Thanks,
Asha.
Re: using OCL with other modelling tools [message #7512 is a reply to message #7490] Wed, 28 December 2005 06:48 Go to previous messageGo to next message
Shrawanika is currently offline ShrawanikaFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,
Re: using OCL with other modelling tools [message #7514 is a reply to message #7501] Wed, 28 December 2005 14:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: info.dfm2html.com

> We are storing our meta models and models in database. So have our own
> implementation of EMF ecore interfaces which access the model from
> database.

Have you tried this: http://www.sympedia.org/cdo/

>
> For OCL Meta model we are not going to use our specialisation
> implementation. The deault ecore implementation in fine with us.
I myself miss a short introduction about using the OCL packages.
I think there is only the current implementation + an emty EMFT project
homepage.
Re: using OCL with other modelling tools [message #9772 is a reply to message #7501] Wed, 28 December 2005 18:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

I'm not sure that I understand your situation. Are you implementing the
Ecore APIs (EPackage, EClassifier, EStructuralFeature, etc.) yourself or
are you creating something entirely different?

All that you need is to be able to coerce your metamodel representation to
the Ecore API, by wrapping your classifiers in EClassifiers etc. or
whatever else it takes.

For example, I know of a commercial application that coerces class models
implemented via UML (which has a representation of namespaces, classifiers,
properties, etc. that differs from Ecore) to the Ecore protocol by wrapping
UML Classes in EClass adapters, etc. Just a classic instance of the
Adapter pattern from the Gang of Four book.

As long as you can provide EObjects and/or EClassifiers as the "context" to
the IOclHelper interface, everything should be fine. The OCL parser does
not care how you implemented the Ecore API.

Cheers,

Christian

Asha wrote:

> Hi ,
>
> Basically we want to have our own implementation of EMF Ecore interfaces
> as we store models in our own form. We want to use OCL tool which works
> with our EMF implementation. So how do we hook our EMF implementation so
> that we can use OCL tool. We used EMF's XMI tool successfully by
> specialising and extending appropriate Resource and Factory and Helper
> implementation. We are looking for similar kind of hooks in OCL tool as
> well.
>
> One Clarification to the above.
> -------------------------------
> We are storing our meta models and models in database. So have our own
> implementation of EMF ecore interfaces which access the model from
> database.
>
> For OCL Meta model we are not going to use our specialisation
> implementation. The deault ecore implementation in fine with us.
>
> Please tell if this is possible , if yes how to do this.
>
> Thanks,
> Asha.
Re: using OCL with other modelling tools [message #9795 is a reply to message #9772] Thu, 29 December 2005 12:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi Christian,

Yes we are implementing the Ecore APIs (EPackage, EClassifier,
EStructuralFeature, etc.) ourself.

In the similar line of MOF API and EMF API, we have our own model API. Its
implementation accesses our storage of model.

So our ECore APIs implementation is kind of wrapper on our model API.

This is done to use EMF tools like XMI , OCL etc with our model repository.

Will try to provide EObjects and/or EClassifiers as the "context" to
the IOclHelper interface and get back to you in case of problems.

Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #10173 is a reply to message #7424] Thu, 12 January 2006 09:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi,

I tried to use OCL project at http://oslo-project.berlios.de. I also
tried kent project at http://www.cs.kent.ac.uk/projects/ocl which has
provided bridge for EMF.

I observed that both the OCL implementation accesses the generated get*
method using getGetterName

Sample Code from Ocl project.
class EmfEvaluationAdapter
{
:
public String getGetterName(Property property)
{
String name = property.getName();
Classifier type = property.getType();
String upperName = name.substring(0, 1).toUpperCase() +
name.substring(1, name.length());
if(type instanceof BooleanType)
return "is" + upperName;
else
return "get" + upperName;
}
}

Problem:
--------
We don't generate model code using EMF for a specific meta model but we
have implemented ECore api ( EObject , EClass EPackage...)

So we need OCL implementation which invokes EObject::eGet(..) method
instead of specific get method.

Is this support there? If yes can you please tell how to use it.

Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #12247 is a reply to message #9795] Thu, 12 January 2006 12:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rajbhoj.yahoo.com

Hi,

I am getting following error while using ocl plugins.

java.lang.NullPointerException
at
org.eclipse.emf.ocl.internal.OclEnginePlugin.shouldTrace(Ocl EnginePlugin.java:135)
at
org.eclipse.emf.ocl.internal.OclEnginePlugin.catching(OclEng inePlugin.java:116)
at org.eclipse.emf.ocl.helper.OclHelper.propagate(OclHelper.jav a:286)
at org.eclipse.emf.ocl.helper.OclHelper.evaluate(OclHelper.java :193)
at oclPkg.TestOCL1.testfunction(TestOCL1.java:41)
at oclPkg.TestOCL1.main(TestOCL1.java:20)
Exception in thread "main"


My program is as follows.

public static void main(String[] args)
{
OclTestPackage newPackage = OclTestPackage.eINSTANCE;
IOclHelper testHelp = HelperUtil.createOclHelper();
Apple apple1 = OclTestFactory.eINSTANCE.createApple();

apple1.setLabel("Alfanzo");
EClassifier clsApple = newPackage.getEClassifier("Apple");
testHelp.setContext(clsApple);
String expr =
"Fruit.allInstances()->select(f : Fruit | f.color =
Color::black)->isEmpty()";
try {
testHelp.evaluate(apple1,expr);
}
catch (OclParsingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

It looks like its failing as OclEnginePlugin plugin variable is not set.
How to set this? Is the usage correct or we are missing something?

One more thing is this ocl plugin use EObject::eGet(..) Api to fetch the
values of property or assumes generated get method?

Please reply,

Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #12255 is a reply to message #10173] Thu, 12 January 2006 14:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hello, Asha,

The EMFT implementation of OCL uses EMF reflection exclusively. The
Environment looks up metamodel features using the EClass's accessors for
structural features, and accesses the structural features of objects using
eGet().

There's nothing that you have to do to enable this. It's just the way our
interpreter works.

Cheers,

Christian


Asha wrote:

> Hi,
>
> I tried to use OCL project at http://oslo-project.berlios.de. I also
> tried kent project at http://www.cs.kent.ac.uk/projects/ocl which has
> provided bridge for EMF.
>
> I observed that both the OCL implementation accesses the generated get*
> method using getGetterName
>
> Sample Code from Ocl project.
> class EmfEvaluationAdapter
> {
> :
> public String getGetterName(Property property)
> {
> String name = property.getName();
> Classifier type = property.getType();
> String upperName = name.substring(0, 1).toUpperCase() +
> name.substring(1, name.length());
> if(type instanceof BooleanType)
> return "is" + upperName;
> else
> return "get" + upperName;
> }
> }
>
> Problem:
> --------
> We don't generate model code using EMF for a specific meta model but we
> have implemented ECore api ( EObject , EClass EPackage...)
>
> So we need OCL implementation which invokes EObject::eGet(..) method
> instead of specific get method.
>
> Is this support there? If yes can you please tell how to use it.
>
> Thanks and Regards,
> Asha.
Re: using OCL with other modelling tools [message #12264 is a reply to message #12247] Thu, 12 January 2006 14:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

From your stack trace, it appears that your TestOCL1 class is running as a
Java application. The OCL engine is an Eclipse plug-in and requires the
Eclipse platform at run-time. The NPE is caused by the plug-in not having
been started.

Christian


Asha wrote:

> Hi,
>
> I am getting following error while using ocl plugins.
>
> java.lang.NullPointerException
> at
>
org.eclipse.emf.ocl.internal.OclEnginePlugin.shouldTrace(Ocl EnginePlugin.java:135)
> at
>
org.eclipse.emf.ocl.internal.OclEnginePlugin.catching(OclEng inePlugin.java:116)
> at org.eclipse.emf.ocl.helper.OclHelper.propagate(OclHelper.jav a:286)
> at org.eclipse.emf.ocl.helper.OclHelper.evaluate(OclHelper.java :193)
> at oclPkg.TestOCL1.testfunction(TestOCL1.java:41)
> at oclPkg.TestOCL1.main(TestOCL1.java:20)
> Exception in thread "main"
>
>
> My program is as follows.
>
> public static void main(String[] args)
> {
> OclTestPackage newPackage = OclTestPackage.eINSTANCE;
> IOclHelper testHelp = HelperUtil.createOclHelper();
> Apple apple1 = OclTestFactory.eINSTANCE.createApple();
>
> apple1.setLabel("Alfanzo");
> EClassifier clsApple = newPackage.getEClassifier("Apple");
> testHelp.setContext(clsApple);
> String expr =
> "Fruit.allInstances()->select(f : Fruit | f.color =
> Color::black)->isEmpty()";
> try {
> testHelp.evaluate(apple1,expr);
> }
> catch (OclParsingException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> }
>
> It looks like its failing as OclEnginePlugin plugin variable is not set.
> How to set this? Is the usage correct or we are missing something?
>
> One more thing is this ocl plugin use EObject::eGet(..) Api to fetch the
> values of property or assumes generated get method?
>
> Please reply,
>
> Thanks and Regards,
> Asha.
Re: using OCL with other modelling tools [message #12350 is a reply to message #12264] Thu, 19 January 2006 06:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: asha.rabhoj.yahoo.com

Hi,

Thanks for your help. We could use OCL implementation for some examples.
But when I have referances in OCL expression , I am getting exception.

This is because of use of "==" in typeCompare function instead of
equals(Object)

Is this a bug , or it is expected to have same referances for same class?

============================================================ ====
org.eclipse.emf.ocl.helper.OclParsingException[1]:
java.lang.IllegalArgumentException: Conformance Type Mismatch. No common
supertype: (Attribute), (Attribute)
self.attribute
[null]

at
org.eclipse.emf.ocl.types.internal.impl.AnyTypeImpl.typeComp are(AnyTypeImpl.java:485)
at
org.eclipse.emf.ocl.types.internal.impl.CollectionTypeImpl.t ypeCompare(CollectionTypeImpl.java:612)
at
org.eclipse.emf.ocl.types.internal.impl.AnyTypeImpl.typeComp are(AnyTypeImpl.java:464)
at
org.eclipse.emf.ocl.expressions.internal.impl.ValidationVisi torImpl.visitAssociationEndCallExp(ValidationVisitorImpl.jav a:587)
at
org.eclipse.emf.ocl.expressions.internal.impl.AssociationEnd CallExpImpl.accept(AssociationEndCallExpImpl.java:87)
at
org.eclipse.emf.ocl.expressions.internal.impl.ValidationVisi torImpl.visitConstraint(ValidationVisitorImpl.java:1474)
at
org.eclipse.emf.ocl.uml.internal.impl.ConstraintImpl.accept( ConstraintImpl.java:169)
at
org.eclipse.emf.ocl.expressions.util.ExpressionsUtil.createI nvariant(ExpressionsUtil.java:146)
at org.eclipse.emf.ocl.helper.OclHelper.evaluate(OclHelper.java :188)
at com.tcs.emf.ocl.OclEvaluator.evaluateOclToObject(OclEvaluato r.java:52)
at testSample.actions.OclTester.test6(OclTester.java:222)
at testSample.actions.OclTester.runAlltest(OclTester.java:97)
at testSample.actions.SampleAction.run(SampleAction.java:54)
at
org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:246)
at
org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPl uginAction.java:223)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:441)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:103)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
============================================================ ======

Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #12396 is a reply to message #12350] Thu, 19 January 2006 13:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

Yes, the assumption in the OCL parser is that EClassifiers are compared by
identity, not value-equality. EMF does not work well with EObjects that
attempt to implement value equality, and this includes the Ecore metamodel.

Perhaps we could find a way to parameterize the parser to optionally use
equals() instead of ==; in most cases these are synonymous anyway (not in
yours).

Please, raise a bugzilla indicating precisely the equality checks that you
require.

Thanks,

Christian


Asha wrote:

> Hi,
>
> Thanks for your help. We could use OCL implementation for some examples.
> But when I have referances in OCL expression , I am getting exception.
>
> This is because of use of "==" in typeCompare function instead of
> equals(Object)
>
> Is this a bug , or it is expected to have same referances for same class?
>
> ============================================================ ====
> org.eclipse.emf.ocl.helper.OclParsingException[1]:
> java.lang.IllegalArgumentException: Conformance Type Mismatch. No common
> supertype: (Attribute), (Attribute)
> self.attribute
> [null]
>

<snip>
Re: using OCL with other modelling tools [message #14617 is a reply to message #10173] Fri, 20 January 2006 13:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hein..fokus.fraunhofer

Hi Asha,

the method is still in the code, but not used in OSLO.
We also use a reflective mechanism to get properties.

If you check out it from our subversion you will see it.

In the subversion is also stored a litte GUI example, which evaluates
OCL constraints against UML2 models (based on uml2.ecore).

Hope it helps you
Christian


Asha schrieb:
> Hi,
>
> I tried to use OCL project at http://oslo-project.berlios.de. I also
> tried kent project at http://www.cs.kent.ac.uk/projects/ocl which has
> provided bridge for EMF.
>
> I observed that both the OCL implementation accesses the generated get*
> method using getGetterName
>
> Sample Code from Ocl project.
> class EmfEvaluationAdapter
> {
> :
> public String getGetterName(Property property)
> {
> String name = property.getName();
> Classifier type = property.getType();
> String upperName = name.substring(0, 1).toUpperCase() +
> name.substring(1, name.length());
> if(type instanceof BooleanType)
> return "is" + upperName;
> else
> return "get" + upperName;
> }
> }
>
> Problem:
> --------
> We don't generate model code using EMF for a specific meta model but we
> have implemented ECore api ( EObject , EClass EPackage...)
>
> So we need OCL implementation which invokes EObject::eGet(..) method
> instead of specific get method.
> Is this support there? If yes can you please tell how to use it.
>
> Thanks and Regards,
> Asha.
>
>
>
Re: using OCL with other modelling tools [message #18227 is a reply to message #4775] Fri, 27 January 2006 18:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jos.warmer.xs4all.nl

If you need an OCL implementation based on Eclipse you might also look at
Octopus. We are in the process of getting it on sourceforge. For now you
can take a look (and download) at http://www.klasse.nl/octopus/index.html.

Jos Warmer
Re: using OCL with other modelling tools [message #18295 is a reply to message #18227] Sun, 29 January 2006 01:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: info.dfm2html.com

> If you need an OCL implementation based on Eclipse you might also look at
> Octopus. We are in the process of getting it on sourceforge. For now you
> can take a look (and download) at http://www.klasse.nl/octopus/index.html.
>
Are there any advantages over the Eclipse OCL implementations?
Re: using OCL with other modelling tools [message #18410 is a reply to message #18295] Tue, 31 January 2006 08:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jos.warmer.klasse.nl

Jorg,

Advanrtages? Yes and no, Octopus has a different target usage.

Octopus is meant to be used by modelers that use OCL at the modeling
level. For this reason Octopus provides a set of plugins that turn
Eclipse into an IDE for OCL. Understandable error messages, nicely in
the taskbar etc.

From the combination of a UML model (potentially imported from XMI) and
OCL a full Java application is generated, including a simple storage in
XML and a user interface using Eclipse RCP. Other contributors are
currently working on an Hibernate back end, a JSF front end, and JSR-220
Persistence.

Octopus is also different from several other approaches because it
generates native Java code from OCL, it does not interpret anything.
The generated code from OCL in Octopus is standalone Java and has no
dependencies on Eclipse.

Octopus does not work directly with EMF or Ecore. When we started the
project EMF was in its infancy (or even not there yet) and we could not
use it at that stage.

That sums up the major differences. I'll let you decide whether they are
advantages for your situation.

Jos

Jörg wrote:
>> If you need an OCL implementation based on Eclipse you might also look at
>> Octopus. We are in the process of getting it on sourceforge. For now you
>> can take a look (and download) at http://www.klasse.nl/octopus/index.html.
>>
> Are there any advantages over the Eclipse OCL implementations?
>
>
Re: using OCL with other modelling tools [message #19838 is a reply to message #12396] Thu, 02 February 2006 06:33 Go to previous message
Shrawanika is currently offline ShrawanikaFriend
Messages: 16
Registered: July 2009
Junior Member
Thanks!

I filed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=126145
Re: using OCL with other modelling tools [message #561693 is a reply to message #4775] Tue, 29 November 2005 13:48 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

Yes, you certainly can use the OCL interpreter with any EMF-implemented
metamodel. There are two "modes" in which it can be used:

- to constrain/query models (instances of your EMF metamodel)
- to include constraints in your models (constraining run-time systems)

The first mode is just a straight-forward application of the IOclHelper API
with the EcoreEnvironment.

The second mode is the case where your EMF metamodel is, itself, a metamodel
for describing software systems or data. The org.eclipse.uml2 API falls
into this category, being an EMF-based metamodel for describing software or
data (as Ecore is). For such applications, you need to provide your own
implementation of the Environment API (via a custom EnvironmentFactory)
that maps your metamodel types to corresponding Ecore types (as Ecore is
the interpreter's "language").

Also, it should be feasible to use the Environment API to map any Java model
(not necessarily EMF-based) to Ecore to work with OCL. This is untried.

There is precious little documentation for any of this. Your best bet is to
see how some of the unit tests make use of the IOclHelper, Environment, and
EnvironmentFactory interfaces.

HTH,

Christian


Asha wrote:

> Hi,
>
> Is it possible to use OCL in EMFT project with other modelling frameworks
> which are
> - EMF compliant
> - or MOF compliant.
>
> If yes. Is there any document available which tells how to use this.
>
> I looked at documents available with gmf help but could not find this
> info.
>
> Thanks in advance.
>
> ~Asha
Re: using OCL with other modelling tools [message #561770 is a reply to message #4844] Thu, 01 December 2005 12:11 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi,

We would like to know about the licensing policy about usage of EMFT
subproject.

We are building modelling framework. Can we distribute the EMFT
deliverables as part of out tool?

Where can we find details of licensing policy.

Thanks in advance,
Asha
Re: using OCL with other modelling tools [message #561788 is a reply to message #5118] Thu, 01 December 2005 12:55 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33224
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070202020206030206080809
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Asha,

EMFT, like everything else at Eclipse, is made available via the Eclipse
Public License. Any question you might have about EPL is the same for
all projects.

http://www.eclipse.org/legal/

You can check out the long decisions about EPL in the foundation
newsgroup.

My understanding is that yes, you can redistribute anything you want fee
of charge.


Asha wrote:

> Hi,
>
> We would like to know about the licensing policy about usage of EMFT
> subproject.
> We are building modelling framework. Can we distribute the EMFT
> deliverables as part of out tool?
>
> Where can we find details of licensing policy.
>
> Thanks in advance,
> Asha



--------------070202020206030206080809
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Asha,<br>
<br>
EMFT, like everything else at Eclipse, is made available via the
Eclipse
Public License.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: using OCL with other modelling tools [message #561808 is a reply to message #5188] Wed, 07 December 2005 07:25 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Ed,

Thanks for the information. I want to download emft project as I need to
reuse OCL implementation.

I tried to connect to CVS repository as per the instruction available at
http://eclipse.org/emf/docs.php?doc=docs/cvsdoc/emfcvsug.htm l

But could not success. It seems access is blocked due to security
constraint ( firewalls ) in our organisation.

I could see the code through viewcvs link , but there are so many files.
Its very time consuming to download file by file through this link.

Can you pl suggest if there is any other alternative to download this
project.

Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #561827 is a reply to message #5254] Wed, 07 December 2005 13:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33224
Registered: July 2009
Senior Member
Asha,

We are making good progress on setting up the builds so hopefully we'll
have packaged builds available within another week.


Asha wrote:

> Hi Ed,
>
> Thanks for the information. I want to download emft project as I need
> to reuse OCL implementation.
>
> I tried to connect to CVS repository as per the instruction available
> at http://eclipse.org/emf/docs.php?doc=docs/cvsdoc/emfcvsug.htm l
>
> But could not success. It seems access is blocked due to security
> constraint ( firewalls ) in our organisation.
>
> I could see the code through viewcvs link , but there are so many
> files. Its very time consuming to download file by file through this
> link.
>
> Can you pl suggest if there is any other alternative to download this
> project.
>
> Thanks and Regards,
> Asha.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: using OCL with other modelling tools [message #561862 is a reply to message #5321] Fri, 09 December 2005 12:05 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi,

We have implemented EMF ecore interfaces so that we can have a choice of
storage for models. This way we could reuse EMF's XMI with our tools.
Our implmentation of EMF interfaces is reflective. We don't generate code
for differant meta models.

Same implementation works for any metamodel.

Is it possible to use OCL project in above manner as well ?
Is OCL implementation understands EMF model?

I went through the org.eclipse.emft.tests . But could not get the handle
on how to start?

In order to execute any ocl query / expression on a model how to start
with. Where to use OCLExpression , IOCLHelper , Query is not clear.

Query has evaluate which accepts Object , But just with object how does it
know about fetching othere details about models? How does OCL classes
queries models of EMF?

Please correct me if my interpretation are wrong.

Thanks,
Asha.
Re: using OCL with other modelling tools [message #561886 is a reply to message #5375] Fri, 09 December 2005 17:44 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

See some responses in-line, below.

Christian


Asha wrote:

> Hi,
>
> We have implemented EMF ecore interfaces so that we can have a choice of
> storage for models. This way we could reuse EMF's XMI with our tools.
> Our implmentation of EMF interfaces is reflective. We don't generate code
> for differant meta models.
>
> Same implementation works for any metamodel.
>
> Is it possible to use OCL project in above manner as well ?
> Is OCL implementation understands EMF model?

Yes. The OCL interpreter's metamodel is Ecore. The context type of any OCL
expression is an EClassifier, and the evaluation of expressions is
performed on instances of EClassifiers (which may be EObjects or, in the
case where the context is an EDataType, any Java object).


> I went through the org.eclipse.emft.tests . But could not get the handle
> on how to start?

The best thing to do is to install the OCL Interpreter example
(org.eclipse.emf.ocl.examples.interpreter) from the EMFT OCL Examples
feature. Once you have done that, you can right-click in an EXTLibrary
editor (for *.extlibrary resources using the "extended library" example
metamodel of EMF) to open the OCL Interpreter console. This console lets
you enter arbitrary OCL expressions and evaluate them (just press the Enter
key).

Look inside the example's code to see how it uses the IOCLHelper interface
to parse and evaluate expressions.


> In order to execute any ocl query / expression on a model how to start
> with. Where to use OCLExpression , IOCLHelper , Query is not clear.

The IOCLHelper interface is your primary point of contact for OCL services.
It parses expressions, evaluates them, and provides content-assist the
capability for editors. The result of parsing an expression is an
OCLExpression object, which is really only interesting if you want to
evaluate it (externally of the helper) or attach it to some EMF resource.
The Query interface is used internally by the IOCLHelper API, and would
only really be useful if you need to parse the full specification of OCL
constraints including package, classifier, and operation contexts (such as
if you were bulk-loading constraints from a text file into your
application).


> Query has evaluate which accepts Object , But just with object how does it
> know about fetching othere details about models? How does OCL classes
> queries models of EMF?

For evaluating constraints, the IOCLHelper is more "friendly" than the Query
API. In both cases, however, the Object that you pass as the evaluation
context is an instance of the context type of an OCLExpression. The
OCLExpression has already stored all the information required for
traversing the references between objects, accessing their attributes, etc.
The major advantage of the IOCLHelper over the Query interface for
evaluating expressions is that it has better support for the allInstances()
operation. The IOCLHelper knows how to efficiently find all of the
instances of an EClass in your Resource, whereas the Query requires you to
provide a mapping of EClasses to extents. The OCL Interpreter example also
demonstrates this capability.

>
> Please correct me if my interpretation are wrong.
>
> Thanks,
> Asha.
Re: using OCL with other modelling tools [message #562012 is a reply to message #7314] Thu, 15 December 2005 13:37 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi ,

Thanks for the detailed reply. There are few more queries.

After going through the example we could understand that
we can have our own resourceFactory and register Meta package with this as
follows , so that we can control creation of resource through.

Please verify our understanding
===============================
//one time initialization
ResourceSet rset = new ResourceSetImpl();

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "ecore",
new SpeciatizedResourceFactoryImpl() );

Resource res = rset.getResource(URI.createURI("uriOfOurMetaPackage"),
true);


//during evaluation

EClass x; // this will point to our implementation.
IOclHelper helper = HelperUtil.createOclHelper();
helper.setContext(x);

String expr = "some ocl expression to be evaluated";
EObject y ; //object on which OCL expression to be evaluated ???please
check
helper.evaluate(y , expr)


Through resource hook we can supply our specific ecore implementation to
OCL implementation.

some doubts
===========
1) But we couldn't get which emf api is used by ocl implementation to get
instances of a particular classifier through resource so that we can
extend this method.

Does it refer to getContents and filter out classifier specific instances
? But it would be very costly ...

2) Why ResourceSet is used in example. Is there any special reason for
this.

3) Before evaluation how to check whether OCL expression is valid (
according to meta model ) , compiling etc. Does Helper has any api for
this.. if yes how to use it.

4) Hepler has createPrecondition , createPOstcondition ,
createBodyCondition , createInvarient... are we suppose to use these hooks?


Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #562101 is a reply to message #4775] Fri, 16 December 2005 14:13 Go to previous message
Eclipse UserFriend
Originally posted by: hein..fokus.fraunhofer

Hi Asha,

Perhaps you are interrested in another EMF OCL Tool. It's called OSLO
and it's based on the Kent OCL Library. You can find it at
http://oslo-project.berlios.de


Best regards,
Christian


Asha schrieb:
> Hi,
>
> Is it possible to use OCL in EMFT project with other modelling
> frameworks which are - EMF compliant - or MOF compliant.
>
> If yes. Is there any document available which tells how to use this.
>
> I looked at documents available with gmf help but could not find this info.
>
> Thanks in advance.
>
> ~Asha
>
>
Re: using OCL with other modelling tools [message #562123 is a reply to message #7379] Wed, 21 December 2005 23:01 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

I don't understand what you are attempting to do by using a specialized
resource implementation to load Ecore models. That has nothing to do with
the OCL parser.

If you use the IOclHelper with the default EcoreEnvironmentFactory, then the
OCL parser can find any classifier in your EPackage by navigating from the
context classifier that you specify (in your example below this is 'x').

So, in response to your question (1): why would the OCL implementation need
to access your Ecore resource? The EClass x that you specified knows its
EPackage, and the OCL implementation just asks the EPackage for a
classifier by name when it needs to look it up (using the
EPackage::getEClassifier(String name) method).

Regarding question (2): I don't know what example you are talking about
that uses a ResourceSet to load an Ecore resource. None of the examples in
the EMFT project does this, as it doesn't make sense.

In answer to (3): The IOclHelper has a createInvariant(String) method (as
well as createPrecondition(String), etc. for operation constraints) that
"compiles" the OCL expression as an OclExpression object. We have a
bugzilla (https://bugs.eclipse.org/bugs/show_bug.cgi?id=114921) requesting
to add support for evaluating a pre-compiled OCL expression. Regarding
validation of an OCL expression, the evaluate() method already does this
implicitly in parsing it, and throws an exception if the expression is
invalid. The createInvariant() and related methods do the same.

In answer to (4): These parsing methods will become more useful when the
bugzilla above is fixed, to pre-compile expressions for later or repeated
evaluation. However, they are already useful for other purposes such as
analyzing them via a Visitor (the OclExpression is an abstract syntax
tree).

I recommend having a look at the boolean evaluate(String expression) method
of the OclConsolePage class in the org.eclipse.emf.ocl.examples.interpreter
example plug-in. It shows how the currently selected object ('context') is
used as the context object when evaluating the OCL expression supplied by
the user in the console. The IOclHelper accepts either an object or its
EClassifier as the context (via the setContext() method) when using the
EcoreEnvironmentFactory. The 'context' object is again used in evaluating
the expression to assign it to the 'self' variable in the OCL expression.

HTH,

Christian


Asha wrote:

> Hi ,
>
> Thanks for the detailed reply. There are few more queries.
>
> After going through the example we could understand that
> we can have our own resourceFactory and register Meta package with this as
> follows , so that we can control creation of resource through.
>
> Please verify our understanding
> ===============================
> //one time initialization
> ResourceSet rset = new ResourceSetImpl();
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "ecore",
> new SpeciatizedResourceFactoryImpl() );
>
> Resource res = rset.getResource(URI.createURI("uriOfOurMetaPackage"),
> true);
>
>
> //during evaluation
>
> EClass x; // this will point to our implementation.
> IOclHelper helper = HelperUtil.createOclHelper();
> helper.setContext(x);
>
> String expr = "some ocl expression to be evaluated";
> EObject y ; //object on which OCL expression to be evaluated ???please
> check
> helper.evaluate(y , expr)
>
>
> Through resource hook we can supply our specific ecore implementation to
> OCL implementation.
>
> some doubts
> ===========
> 1) But we couldn't get which emf api is used by ocl implementation to get
> instances of a particular classifier through resource so that we can
> extend this method.
>
> Does it refer to getContents and filter out classifier specific instances
> ? But it would be very costly ...
>
> 2) Why ResourceSet is used in example. Is there any special reason for
> this.
>
> 3) Before evaluation how to check whether OCL expression is valid (
> according to meta model ) , compiling etc. Does Helper has any api for
> this.. if yes how to use it.
>
> 4) Hepler has createPrecondition , createPOstcondition ,
> createBodyCondition , createInvarient... are we suppose to use these
> hooks?
>
>
> Thanks and Regards,
> Asha.
Re: using OCL with other modelling tools [message #562143 is a reply to message #7379] Thu, 22 December 2005 14:51 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

I have just committed Bug 114921 which adds to the IOclHelper API the
ability to evaluate or check an expression that has already been parsed (as
an OclExpression).

So, now you check compile and check the validity of a constraint using
IOclHelper::createInvariant(String expression) and, if you succeed in
getting an OclExpression, can check any number of objects for conformance
to that constraint using IOclHelper::check(Object context, OclExpression
constraint).

Cheers,

Christian


Asha wrote:

> Hi ,
>
> Thanks for the detailed reply. There are few more queries.
>

<snip>

> 3) Before evaluation how to check whether OCL expression is valid (
> according to meta model ) , compiling etc. Does Helper has any api for
> this.. if yes how to use it.

<snip>
Re: using OCL with other modelling tools [message #562223 is a reply to message #7435] Tue, 27 December 2005 12:16 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Christian,

Basically we want to have our own implementation of EMF Ecore interfaces
as we store models in our own form. We want to use OCL tool which works
with our EMF implementation.

So how do we hook our EMF implementation so that we can use OCL tool.

We used EMF's XMI tool successfully by specialising and extending
appropriate Resource and Factory and Helper implementation.

We are looking for similar kind of hooks in OCL tool as well.

Thanks,
Asha.
Re: using OCL with other modelling tools [message #562249 is a reply to message #7479] Tue, 27 December 2005 14:53 Go to previous message
Eclipse UserFriend
Originally posted by: info.dfm2html.com

> Basically we want to have our own implementation of EMF Ecore interfaces
> as we store models in our own form. We want to use OCL tool which works
> with our EMF implementation.

Why do you not define your meta model with Ecore itself, like it is done
for the UML2 meta model, instead of modifying Ecore somehow?

> as we store models in our own form.
I think the persistence is independent of your problem.
E.g. the OCL expressions are parsed with ANTLR and the generated AST is an
Ecore model,
and later is persisted in OCL syntax.

Does anyone know by the way how to generate an editor for OCL expressions?
I imported org.eclipse.emf.ocl as source project, opened model/ocl.genmodel,
but all the menu items like "Generate Editor Code" are disabled.
Re: using OCL with other modelling tools [message #562272 is a reply to message #7479] Wed, 28 December 2005 04:26 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi ,

Basically we want to have our own implementation of EMF Ecore interfaces
as we store models in our own form. We want to use OCL tool which works
with our EMF implementation. So how do we hook our EMF implementation so
that we can use OCL tool. We used EMF's XMI tool successfully by
specialising and extending appropriate Resource and Factory and Helper
implementation. We are looking for similar kind of hooks in OCL tool as
well.

One Clarification to the above.
-------------------------------
We are storing our meta models and models in database. So have our own
implementation of EMF ecore interfaces which access the model from
database.

For OCL Meta model we are not going to use our specialisation
implementation. The deault ecore implementation in fine with us.

Please tell if this is possible , if yes how to do this.

Thanks,
Asha.
Re: using OCL with other modelling tools [message #562296 is a reply to message #7490] Wed, 28 December 2005 06:48 Go to previous message
Shrawanika is currently offline ShrawanikaFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,
Re: using OCL with other modelling tools [message #562299 is a reply to message #7501] Wed, 28 December 2005 14:02 Go to previous message
Eclipse UserFriend
Originally posted by: info.dfm2html.com

> We are storing our meta models and models in database. So have our own
> implementation of EMF ecore interfaces which access the model from
> database.

Have you tried this: http://www.sympedia.org/cdo/

>
> For OCL Meta model we are not going to use our specialisation
> implementation. The deault ecore implementation in fine with us.
I myself miss a short introduction about using the OCL packages.
I think there is only the current implementation + an emty EMFT project
homepage.
Re: using OCL with other modelling tools [message #562345 is a reply to message #7501] Wed, 28 December 2005 18:19 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

I'm not sure that I understand your situation. Are you implementing the
Ecore APIs (EPackage, EClassifier, EStructuralFeature, etc.) yourself or
are you creating something entirely different?

All that you need is to be able to coerce your metamodel representation to
the Ecore API, by wrapping your classifiers in EClassifiers etc. or
whatever else it takes.

For example, I know of a commercial application that coerces class models
implemented via UML (which has a representation of namespaces, classifiers,
properties, etc. that differs from Ecore) to the Ecore protocol by wrapping
UML Classes in EClass adapters, etc. Just a classic instance of the
Adapter pattern from the Gang of Four book.

As long as you can provide EObjects and/or EClassifiers as the "context" to
the IOclHelper interface, everything should be fine. The OCL parser does
not care how you implemented the Ecore API.

Cheers,

Christian

Asha wrote:

> Hi ,
>
> Basically we want to have our own implementation of EMF Ecore interfaces
> as we store models in our own form. We want to use OCL tool which works
> with our EMF implementation. So how do we hook our EMF implementation so
> that we can use OCL tool. We used EMF's XMI tool successfully by
> specialising and extending appropriate Resource and Factory and Helper
> implementation. We are looking for similar kind of hooks in OCL tool as
> well.
>
> One Clarification to the above.
> -------------------------------
> We are storing our meta models and models in database. So have our own
> implementation of EMF ecore interfaces which access the model from
> database.
>
> For OCL Meta model we are not going to use our specialisation
> implementation. The deault ecore implementation in fine with us.
>
> Please tell if this is possible , if yes how to do this.
>
> Thanks,
> Asha.
Re: using OCL with other modelling tools [message #562370 is a reply to message #9772] Thu, 29 December 2005 12:14 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Christian,

Yes we are implementing the Ecore APIs (EPackage, EClassifier,
EStructuralFeature, etc.) ourself.

In the similar line of MOF API and EMF API, we have our own model API. Its
implementation accesses our storage of model.

So our ECore APIs implementation is kind of wrapper on our model API.

This is done to use EMF tools like XMI , OCL etc with our model repository.

Will try to provide EObjects and/or EClassifiers as the "context" to
the IOclHelper interface and get back to you in case of problems.

Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #562784 is a reply to message #7424] Thu, 12 January 2006 09:00 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi,

I tried to use OCL project at http://oslo-project.berlios.de I also
tried kent project at http://www.cs.kent.ac.uk/projects/ocl which has
provided bridge for EMF.

I observed that both the OCL implementation accesses the generated get*
method using getGetterName

Sample Code from Ocl project.
class EmfEvaluationAdapter
{
:
public String getGetterName(Property property)
{
String name = property.getName();
Classifier type = property.getType();
String upperName = name.substring(0, 1).toUpperCase() +
name.substring(1, name.length());
if(type instanceof BooleanType)
return "is" + upperName;
else
return "get" + upperName;
}
}

Problem:
--------
We don't generate model code using EMF for a specific meta model but we
have implemented ECore api ( EObject , EClass EPackage...)

So we need OCL implementation which invokes EObject::eGet(..) method
instead of specific get method.

Is this support there? If yes can you please tell how to use it.

Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #562809 is a reply to message #9795] Thu, 12 January 2006 12:04 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi,

I am getting following error while using ocl plugins.

java.lang.NullPointerException
at
org.eclipse.emf.ocl.internal.OclEnginePlugin.shouldTrace(Ocl EnginePlugin.java:135)
at
org.eclipse.emf.ocl.internal.OclEnginePlugin.catching(OclEng inePlugin.java:116)
at org.eclipse.emf.ocl.helper.OclHelper.propagate(OclHelper.jav a:286)
at org.eclipse.emf.ocl.helper.OclHelper.evaluate(OclHelper.java :193)
at oclPkg.TestOCL1.testfunction(TestOCL1.java:41)
at oclPkg.TestOCL1.main(TestOCL1.java:20)
Exception in thread "main"


My program is as follows.

public static void main(String[] args)
{
OclTestPackage newPackage = OclTestPackage.eINSTANCE;
IOclHelper testHelp = HelperUtil.createOclHelper();
Apple apple1 = OclTestFactory.eINSTANCE.createApple();

apple1.setLabel("Alfanzo");
EClassifier clsApple = newPackage.getEClassifier("Apple");
testHelp.setContext(clsApple);
String expr =
"Fruit.allInstances()->select(f : Fruit | f.color =
Color::black)->isEmpty()";
try {
testHelp.evaluate(apple1,expr);
}
catch (OclParsingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

It looks like its failing as OclEnginePlugin plugin variable is not set.
How to set this? Is the usage correct or we are missing something?

One more thing is this ocl plugin use EObject::eGet(..) Api to fetch the
values of property or assumes generated get method?

Please reply,

Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #562842 is a reply to message #10173] Thu, 12 January 2006 14:03 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hello, Asha,

The EMFT implementation of OCL uses EMF reflection exclusively. The
Environment looks up metamodel features using the EClass's accessors for
structural features, and accesses the structural features of objects using
eGet().

There's nothing that you have to do to enable this. It's just the way our
interpreter works.

Cheers,

Christian


Asha wrote:

> Hi,
>
> I tried to use OCL project at http://oslo-project.berlios.de I also
> tried kent project at http://www.cs.kent.ac.uk/projects/ocl which has
> provided bridge for EMF.
>
> I observed that both the OCL implementation accesses the generated get*
> method using getGetterName
>
> Sample Code from Ocl project.
> class EmfEvaluationAdapter
> {
> :
> public String getGetterName(Property property)
> {
> String name = property.getName();
> Classifier type = property.getType();
> String upperName = name.substring(0, 1).toUpperCase() +
> name.substring(1, name.length());
> if(type instanceof BooleanType)
> return "is" + upperName;
> else
> return "get" + upperName;
> }
> }
>
> Problem:
> --------
> We don't generate model code using EMF for a specific meta model but we
> have implemented ECore api ( EObject , EClass EPackage...)
>
> So we need OCL implementation which invokes EObject::eGet(..) method
> instead of specific get method.
>
> Is this support there? If yes can you please tell how to use it.
>
> Thanks and Regards,
> Asha.
Re: using OCL with other modelling tools [message #562863 is a reply to message #12247] Thu, 12 January 2006 14:10 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

From your stack trace, it appears that your TestOCL1 class is running as a
Java application. The OCL engine is an Eclipse plug-in and requires the
Eclipse platform at run-time. The NPE is caused by the plug-in not having
been started.

Christian


Asha wrote:

> Hi,
>
> I am getting following error while using ocl plugins.
>
> java.lang.NullPointerException
> at
>
org.eclipse.emf.ocl.internal.OclEnginePlugin.shouldTrace(Ocl EnginePlugin.java:135)
> at
>
org.eclipse.emf.ocl.internal.OclEnginePlugin.catching(OclEng inePlugin.java:116)
> at org.eclipse.emf.ocl.helper.OclHelper.propagate(OclHelper.jav a:286)
> at org.eclipse.emf.ocl.helper.OclHelper.evaluate(OclHelper.java :193)
> at oclPkg.TestOCL1.testfunction(TestOCL1.java:41)
> at oclPkg.TestOCL1.main(TestOCL1.java:20)
> Exception in thread "main"
>
>
> My program is as follows.
>
> public static void main(String[] args)
> {
> OclTestPackage newPackage = OclTestPackage.eINSTANCE;
> IOclHelper testHelp = HelperUtil.createOclHelper();
> Apple apple1 = OclTestFactory.eINSTANCE.createApple();
>
> apple1.setLabel("Alfanzo");
> EClassifier clsApple = newPackage.getEClassifier("Apple");
> testHelp.setContext(clsApple);
> String expr =
> "Fruit.allInstances()->select(f : Fruit | f.color =
> Color::black)->isEmpty()";
> try {
> testHelp.evaluate(apple1,expr);
> }
> catch (OclParsingException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> }
>
> It looks like its failing as OclEnginePlugin plugin variable is not set.
> How to set this? Is the usage correct or we are missing something?
>
> One more thing is this ocl plugin use EObject::eGet(..) Api to fetch the
> values of property or assumes generated get method?
>
> Please reply,
>
> Thanks and Regards,
> Asha.
Re: using OCL with other modelling tools [message #563098 is a reply to message #12264] Thu, 19 January 2006 06:16 Go to previous message
Asha Mising name is currently offline Asha Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Hi,

Thanks for your help. We could use OCL implementation for some examples.
But when I have referances in OCL expression , I am getting exception.

This is because of use of "==" in typeCompare function instead of
equals(Object)

Is this a bug , or it is expected to have same referances for same class?

============================================================ ====
org.eclipse.emf.ocl.helper.OclParsingException[1]:
java.lang.IllegalArgumentException: Conformance Type Mismatch. No common
supertype: (Attribute), (Attribute)
self.attribute
[null]

at
org.eclipse.emf.ocl.types.internal.impl.AnyTypeImpl.typeComp are(AnyTypeImpl.java:485)
at
org.eclipse.emf.ocl.types.internal.impl.CollectionTypeImpl.t ypeCompare(CollectionTypeImpl.java:612)
at
org.eclipse.emf.ocl.types.internal.impl.AnyTypeImpl.typeComp are(AnyTypeImpl.java:464)
at
org.eclipse.emf.ocl.expressions.internal.impl.ValidationVisi torImpl.visitAssociationEndCallExp(ValidationVisitorImpl.jav a:587)
at
org.eclipse.emf.ocl.expressions.internal.impl.AssociationEnd CallExpImpl.accept(AssociationEndCallExpImpl.java:87)
at
org.eclipse.emf.ocl.expressions.internal.impl.ValidationVisi torImpl.visitConstraint(ValidationVisitorImpl.java:1474)
at
org.eclipse.emf.ocl.uml.internal.impl.ConstraintImpl.accept( ConstraintImpl.java:169)
at
org.eclipse.emf.ocl.expressions.util.ExpressionsUtil.createI nvariant(ExpressionsUtil.java:146)
at org.eclipse.emf.ocl.helper.OclHelper.evaluate(OclHelper.java :188)
at com.tcs.emf.ocl.OclEvaluator.evaluateOclToObject(OclEvaluato r.java:52)
at testSample.actions.OclTester.test6(OclTester.java:222)
at testSample.actions.OclTester.runAlltest(OclTester.java:97)
at testSample.actions.SampleAction.run(SampleAction.java:54)
at
org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:246)
at
org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPl uginAction.java:223)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:441)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:103)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
============================================================ ======

Thanks and Regards,
Asha.
Re: using OCL with other modelling tools [message #563238 is a reply to message #12350] Thu, 19 January 2006 13:45 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Asha,

Yes, the assumption in the OCL parser is that EClassifiers are compared by
identity, not value-equality. EMF does not work well with EObjects that
attempt to implement value equality, and this includes the Ecore metamodel.

Perhaps we could find a way to parameterize the parser to optionally use
equals() instead of ==; in most cases these are synonymous anyway (not in
yours).

Please, raise a bugzilla indicating precisely the equality checks that you
require.

Thanks,

Christian


Asha wrote:

> Hi,
>
> Thanks for your help. We could use OCL implementation for some examples.
> But when I have referances in OCL expression , I am getting exception.
>
> This is because of use of "==" in typeCompare function instead of
> equals(Object)
>
> Is this a bug , or it is expected to have same referances for same class?
>
> ============================================================ ====
> org.eclipse.emf.ocl.helper.OclParsingException[1]:
> java.lang.IllegalArgumentException: Conformance Type Mismatch. No common
> supertype: (Attribute), (Attribute)
> self.attribute
> [null]
>

<snip>
Re: using OCL with other modelling tools [message #563548 is a reply to message #10173] Fri, 20 January 2006 13:08 Go to previous message
Eclipse UserFriend
Originally posted by: hein..fokus.fraunhofer

Hi Asha,

the method is still in the code, but not used in OSLO.
We also use a reflective mechanism to get properties.

If you check out it from our subversion you will see it.

In the subversion is also stored a litte GUI example, which evaluates
OCL constraints against UML2 models (based on uml2.ecore).

Hope it helps you
Christian


Asha schrieb:
> Hi,
>
> I tried to use OCL project at http://oslo-project.berlios.de I also
> tried kent project at http://www.cs.kent.ac.uk/projects/ocl which has
> provided bridge for EMF.
>
> I observed that both the OCL implementation accesses the generated get*
> method using getGetterName
>
> Sample Code from Ocl project.
> class EmfEvaluationAdapter
> {
> :
> public String getGetterName(Property property)
> {
> String name = property.getName();
> Classifier type = property.getType();
> String upperName = name.substring(0, 1).toUpperCase() +
> name.substring(1, name.length());
> if(type instanceof BooleanType)
> return "is" + upperName;
> else
> return "get" + upperName;
> }
> }
>
> Problem:
> --------
> We don't generate model code using EMF for a specific meta model but we
> have implemented ECore api ( EObject , EClass EPackage...)
>
> So we need OCL implementation which invokes EObject::eGet(..) method
> instead of specific get method.
> Is this support there? If yes can you please tell how to use it.
>
> Thanks and Regards,
> Asha.
>
>
>
Re: using OCL with other modelling tools [message #564619 is a reply to message #4775] Fri, 27 January 2006 18:43 Go to previous message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 66
Registered: July 2009
Member
If you need an OCL implementation based on Eclipse you might also look at
Octopus. We are in the process of getting it on sourceforge. For now you
can take a look (and download) at http://www.klasse.nl/octopus/index.html

Jos Warmer
Re: using OCL with other modelling tools [message #564727 is a reply to message #18227] Sun, 29 January 2006 01:38 Go to previous message
Eclipse UserFriend
Originally posted by: info.dfm2html.com

> If you need an OCL implementation based on Eclipse you might also look at
> Octopus. We are in the process of getting it on sourceforge. For now you
> can take a look (and download) at http://www.klasse.nl/octopus/index.html
>
Are there any advantages over the Eclipse OCL implementations?
Re: using OCL with other modelling tools [message #564959 is a reply to message #18295] Tue, 31 January 2006 08:37 Go to previous message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 66
Registered: July 2009
Member
Jorg,

Advanrtages? Yes and no, Octopus has a different target usage.

Octopus is meant to be used by modelers that use OCL at the modeling
level. For this reason Octopus provides a set of plugins that turn
Eclipse into an IDE for OCL. Understandable error messages, nicely in
the taskbar etc.

From the combination of a UML model (potentially imported from XMI) and
OCL a full Java application is generated, including a simple storage in
XML and a user interface using Eclipse RCP. Other contributors are
currently working on an Hibernate back end, a JSF front end, and JSR-220
Persistence.

Octopus is also different from several other approaches because it
generates native Java code from OCL, it does not interpret anything.
The generated code from OCL in Octopus is standalone Java and has no
dependencies on Eclipse.

Octopus does not work directly with EMF or Ecore. When we started the
project EMF was in its infancy (or even not there yet) and we could not
use it at that stage.

That sums up the major differences. I'll let you decide whether they are
advantages for your situation.

Jos

Jörg wrote:
>> If you need an OCL implementation based on Eclipse you might also look at
>> Octopus. We are in the process of getting it on sourceforge. For now you
>> can take a look (and download) at http://www.klasse.nl/octopus/index.html
>>
> Are there any advantages over the Eclipse OCL implementations?
>
>
Re: using OCL with other modelling tools [message #565336 is a reply to message #12396] Thu, 02 February 2006 06:33 Go to previous message
Shrawanika is currently offline ShrawanikaFriend
Messages: 16
Registered: July 2009
Junior Member
Thanks!

I filed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=126145
Previous Topic:Can Ocl provided by EMFT be used in some stand alone application?
Next Topic:order of returned items
Goto Forum:
  


Current Time: Mon Oct 07 05:28:21 GMT 2024

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

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

Back to the top