Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL and Ecore object relationships
OCL and Ecore object relationships [message #70192] Tue, 05 May 2009 17:04 Go to next message
Eclipse UserFriend
Originally posted by: jose.hernandez.smartstream-stp.com

Hi,

Would anyone be able to explain how MDT OCL goes about determining what
objects to return when EClass.allInstances() is invoked?

Regards,
Jose
Re: OCL and Ecore object relationships [message #70217 is a reply to message #70192] Tue, 05 May 2009 20:58 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

--=-FhHnWREGoVkBFyoVot7u
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Jose,

The implementation of the allInstances() operation relies on an "extent
map" provided to the interpreter by the EvaluationEnvironment. This
evaluation environment is constructed by the OCL facade object or by a
Query, using the metamodel-specific EnvironmentFactory.

The default implementation of the extent map for all metamodels is one
that lazily computes the extents of classes within the scope of a
Resource, that resource being the one containing the EObject that is the
"self" of an OCL expression evaluation. You can provide your own
extent-map implementation if you like, for example to search an entire
ResourceSet for instances of a class.

So, by default, the expression EClass.allInstances() will return all
EClasses in the same resource as the context EObject.

To plug in your own extent map implementation, I suggest you extend the
LazyExtentMap class provided by the OCL API. Then, initialize your OCL
instance with a custom EnvironmentFactory implementation that creates a
custom EvaluationEnvironment implementation that creates your extent
map.

HTH,

Christian

On Tue, 2009-05-05 at 18:04 +0100, Jose Hernandez wrote:

> Hi,
>
> Would anyone be able to explain how MDT OCL goes about determining what
> objects to return when EClass.allInstances() is invoked?
>
> Regards,
> Jose
>
>

--=-FhHnWREGoVkBFyoVot7u
Content-Type: text/html; charset="utf-8"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Hi, Jose,<BR>
<BR>
The implementation of the allInstances() operation relies on an &quot;extent map&quot; provided to the interpreter by the EvaluationEnvironment.&nbsp; This evaluation environment is constructed by the OCL facade object or by a Query, using the metamodel-specific EnvironmentFactory.<BR>
<BR>
The default implementation of the extent map for all metamodels is one that lazily computes the extents of classes within the scope of a Resource, that resource being the one containing the EObject that is the &quot;self&quot; of an OCL expression evaluation. You can provide your own extent-map implementation if you like, for example to search an entire ResourceSet for instances of a class.<BR>
<BR>
So, by default, the expression EClass.allInstances() will return all EClasses in the same resource as the context EObject.<BR>
<BR>
To plug in your own extent map implementation, I suggest you extend the LazyExtentMap class provided by the OCL API.&nbsp; Then, initialize your OCL instance with a custom EnvironmentFactory implementation that creates a custom EvaluationEnvironment implementation that creates your extent map.<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
On Tue, 2009-05-05 at 18:04 +0100, Jose Hernandez wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hi,

Would anyone be able to explain how MDT OCL goes about determining what
objects to return when EClass.allInstances() is invoked?

Regards,
Jose


</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-FhHnWREGoVkBFyoVot7u--
Previous Topic:Looking for help about collections manipulation
Next Topic:stereotype constraints
Goto Forum:
  


Current Time: Thu Mar 28 10:44:41 GMT 2024

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

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

Back to the top