Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Getting all instances from multiple resources
Getting all instances from multiple resources [message #70236] Wed, 06 May 2009 01:38 Go to next message
Rômulo  rpini is currently offline Rômulo rpiniFriend
Messages: 36
Registered: July 2009
Member
Hi all,

I followed this tutorial:

http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /

Well everything was going well but when I tried to use allInstances() I
got some problems and I figured out that allInstances was returning an
empty set.

My problem is: I have one ecore that has references to another ecore. Ok,
now what I want is to be able to get all the instances from this another
ecore.

I tried this:

OntoUML::Mediation.allInstances()->notEmpty()

Where OntoUML is package name of the another ecore.

When I run my plugin and click on "Validate", I always get a message that
the constraint is violated. And after further inspection I figured that
Mediation.allInstances doesnt work. And there are some instances of
mediation on my xml and I m even able to choose then on the properties
view.

Am I doing something wrong?

Sorry If I am not clear, Brazillian here and my english is very bad.
Re: Getting all instances from multiple resources [message #70278 is a reply to message #70236] Wed, 06 May 2009 12:51 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

--=-VvxtGvM+T0JcEXfv6k2q
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Romulo,

See my reply to the previous thread on this newsgroup ("OCL and Ecore
object relationships") for some pointers about widening the scope of the
allInstances() operation. The default implementation finds class
extents only within the contextual resource, but that can be overridden.

HTH,

Christian

On Wed, 2009-05-06 at 01:38 +0000, Romulo Arpini wrote:

> Hi all,
>
> I followed this tutorial:
>
> http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /
>
> Well everything was going well but when I tried to use allInstances() I
> got some problems and I figured out that allInstances was returning an
> empty set.
>
> My problem is: I have one ecore that has references to another ecore. Ok,
> now what I want is to be able to get all the instances from this another
> ecore.
>
> I tried this:
>
> OntoUML::Mediation.allInstances()->notEmpty()
>
> Where OntoUML is package name of the another ecore.
>
> When I run my plugin and click on "Validate", I always get a message that
> the constraint is violated. And after further inspection I figured that
> Mediation.allInstances doesnt work. And there are some instances of
> mediation on my xml and I m even able to choose then on the properties
> view.
>
> Am I doing something wrong?
>
> Sorry If I am not clear, Brazillian here and my english is very bad.
>

--=-VvxtGvM+T0JcEXfv6k2q
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, Romulo,<BR>
<BR>
See my reply to the previous thread on this newsgroup (&quot;OCL and Ecore object relationships&quot;) for some pointers about widening the scope of the allInstances() operation.&nbsp; The default implementation finds class extents only within the contextual resource, but that can be overridden.<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
On Wed, 2009-05-06 at 01:38 +0000, Romulo Arpini wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hi all,

I followed this tutorial:

<A HREF=" http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /"> http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /</A>

Well everything was going well but when I tried to use allInstances() I
got some problems and I figured out that allInstances was returning an
empty set.

My problem is: I have one ecore that has references to another ecore. Ok,
now what I want is to be able to get all the instances from this another
ecore.

I tried this:

OntoUML::Mediation.allInstances()-&gt;notEmpty()

Where OntoUML is package name of the another ecore.

When I run my plugin and click on &quot;Validate&quot;, I always get a message that
the constraint is violated. And after further inspection I figured that
Mediation.allInstances doesnt work. And there are some instances of
mediation on my xml and I m even able to choose then on the properties
view.

Am I doing something wrong?

Sorry If I am not clear, Brazillian here and my english is very bad.

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

--=-VvxtGvM+T0JcEXfv6k2q--
Re: Getting all instances from multiple resources [message #70358 is a reply to message #70278] Wed, 06 May 2009 18:26 Go to previous messageGo to next message
Rômulo  rpini is currently offline Rômulo rpiniFriend
Messages: 36
Registered: July 2009
Member
Hi Christian,

I am beginning with ocl and mdt ocl in general and I m not sure about what
to do.

How can I make my own extent map? I have no idea, actually. Is there any
example out there of someone who already did this?

Thanks in advance.

Best Regards,

Romulo

Christian W. Damus wrote:

> Hi, Romulo,

> See my reply to the previous thread on this newsgroup ("OCL and Ecore
> object relationships") for some pointers about widening the scope of the
> allInstances() operation. The default implementation finds class
> extents only within the contextual resource, but that can be overridden.

> HTH,

> Christian

> On Wed, 2009-05-06 at 01:38 +0000, Romulo Arpini wrote:

>> Hi all,
>>
>> I followed this tutorial:
>>
>> http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /
>>
>> Well everything was going well but when I tried to use allInstances() I
>> got some problems and I figured out that allInstances was returning an
>> empty set.
>>
>> My problem is: I have one ecore that has references to another ecore. Ok,
>> now what I want is to be able to get all the instances from this another
>> ecore.
>>
>> I tried this:
>>
>> OntoUML::Mediation.allInstances()->notEmpty()
>>
>> Where OntoUML is package name of the another ecore.
>>
>> When I run my plugin and click on "Validate", I always get a message that
>> the constraint is violated. And after further inspection I figured that
>> Mediation.allInstances doesnt work. And there are some instances of
>> mediation on my xml and I m even able to choose then on the properties
>> view.
>>
>> Am I doing something wrong?
>>
>> Sorry If I am not clear, Brazillian here and my english is very bad.
>>
Re: Getting all instances from multiple resources [message #70418 is a reply to message #70358] Wed, 06 May 2009 21:18 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

--=-WdjeP0+1sS7J34PZ5XVg
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Romulo,

I don't actually have an example that details how to customize the class
extents for allInstances().

I pointed you to some classes that have fairly complete Javadoc. Also,
the OCL Developer Guide in the on-line help (provided by the OCL SDK)
has information about how to plug in custom environments into the OCL
API. The docs don't address the extent-map, specifically, but should be
helpful in explaining how environments and environment-factories work.

Cheers,

Christian

On Wed, 2009-05-06 at 18:26 +0000, Romulo Arpini wrote:

> Hi Christian,
>
> I am beginning with ocl and mdt ocl in general and I m not sure about what
> to do.
>
> How can I make my own extent map? I have no idea, actually. Is there any
> example out there of someone who already did this?
>
> Thanks in advance.
>
> Best Regards,
>
> Romulo
>
> Christian W. Damus wrote:
>
> > Hi, Romulo,
>
> > See my reply to the previous thread on this newsgroup ("OCL and Ecore
> > object relationships") for some pointers about widening the scope of the
> > allInstances() operation. The default implementation finds class
> > extents only within the contextual resource, but that can be overridden.
>
> > HTH,
>
> > Christian
>
> > On Wed, 2009-05-06 at 01:38 +0000, Romulo Arpini wrote:
>
> >> Hi all,
> >>
> >> I followed this tutorial:
> >>
> >> http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /
> >>
> >> Well everything was going well but when I tried to use allInstances() I
> >> got some problems and I figured out that allInstances was returning an
> >> empty set.
> >>
> >> My problem is: I have one ecore that has references to another ecore. Ok,
> >> now what I want is to be able to get all the instances from this another
> >> ecore.
> >>
> >> I tried this:
> >>
> >> OntoUML::Mediation.allInstances()->notEmpty()
> >>
> >> Where OntoUML is package name of the another ecore.
> >>
> >> When I run my plugin and click on "Validate", I always get a message that
> >> the constraint is violated. And after further inspection I figured that
> >> Mediation.allInstances doesnt work. And there are some instances of
> >> mediation on my xml and I m even able to choose then on the properties
> >> view.
> >>
> >> Am I doing something wrong?
> >>
> >> Sorry If I am not clear, Brazillian here and my english is very bad.
> >>
>

--=-WdjeP0+1sS7J34PZ5XVg
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, Romulo,<BR>
<BR>
I don't actually have an example that details how to customize the class extents for allInstances().<BR>
<BR>
I pointed you to some classes that have fairly complete Javadoc.&nbsp; Also, the OCL Developer Guide in the on-line help (provided by the OCL SDK) has information about how to plug in custom environments into the OCL API.&nbsp; The docs don't address the extent-map, specifically, but should be helpful in explaining how environments and environment-factories work.<BR>
<BR>
Cheers,<BR>
<BR>
Christian<BR>
<BR>
On Wed, 2009-05-06 at 18:26 +0000, Romulo Arpini wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hi Christian,

I am beginning with ocl and mdt ocl in general and I m not sure about what
to do.

How can I make my own extent map? I have no idea, actually. Is there any
example out there of someone who already did this?

Thanks in advance.

Best Regards,

Romulo

Christian W. Damus wrote:

&gt; Hi, Romulo,

&gt; See my reply to the previous thread on this newsgroup (&quot;OCL and Ecore
&gt; object relationships&quot;) for some pointers about widening the scope of the
&gt; allInstances() operation. The default implementation finds class
&gt; extents only within the contextual resource, but that can be overridden.

&gt; HTH,

&gt; Christian

&gt; On Wed, 2009-05-06 at 01:38 +0000, Romulo Arpini wrote:

&gt;&gt; Hi all,
&gt;&gt;
&gt;&gt; I followed this tutorial:
&gt;&gt;
&gt;&gt; <A HREF=" http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /"> http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /</A>
&gt;&gt;
&gt;&gt; Well everything was going well but when I tried to use allInstances() I
&gt;&gt; got some problems and I figured out that allInstances was returning an
&gt;&gt; empty set.
&gt;&gt;
&gt;&gt; My problem is: I have one ecore that has references to another ecore. Ok,
&gt;&gt; now what I want is to be able to get all the instances from this another
&gt;&gt; ecore.
&gt;&gt;
&gt;&gt; I tried this:
&gt;&gt;
&gt;&gt; OntoUML::Mediation.allInstances()-&gt;notEmpty()
&gt;&gt;
&gt;&gt; Where OntoUML is package name of the another ecore.
&gt;&gt;
&gt;&gt; When I run my plugin and click on &quot;Validate&quot;, I always get a message that
&gt;&gt; the constraint is violated. And after further inspection I figured that
&gt;&gt; Mediation.allInstances doesnt work. And there are some instances of
&gt;&gt; mediation on my xml and I m even able to choose then on the properties
&gt;&gt; view.
&gt;&gt;
&gt;&gt; Am I doing something wrong?
&gt;&gt;
&gt;&gt; Sorry If I am not clear, Brazillian here and my english is very bad.
&gt;&gt;

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

--=-WdjeP0+1sS7J34PZ5XVg--
Re: Getting all instances from multiple resources [message #70438 is a reply to message #70418] Wed, 06 May 2009 22:25 Go to previous messageGo to next message
Rômulo  rpini is currently offline Rômulo rpiniFriend
Messages: 36
Registered: July 2009
Member
Hi Christian,

I appreciate your help but I ask if anyone already did this to please,
show me an example about what I need to do because I m really lost.

I really dont know where to start to make my own extent map.
Re: Getting all instances from multiple resources [message #70630 is a reply to message #70438] Thu, 07 May 2009 18:29 Go to previous messageGo to next message
Rômulo  rpini is currently offline Rômulo rpiniFriend
Messages: 36
Registered: July 2009
Member
No one? : (

Christian, could you explain more detailed what you said in that another
topic you mentioned?

I tried that but I really have no idea about where to start.

Please be patience because I am a beginner in EMF.

I understand what you said that the scope of LazyExtentMap is only the
resource of the context. But how can I 'change' this resource to the
resource that I want to get all the instances?

LazyExtentMap uses the context to get the resource, isnt it? So how will I
get the other resource without the context?

Sorry for my terrible english.

And thank you very much.
Re: Getting all instances from multiple resources [message #70662 is a reply to message #70630] Fri, 08 May 2009 12:35 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

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

Hi, Romulo,

Have you read the OCL Developer Guide documentation and what it says
about the relationship between the OCL parser/interpreter and the
various environment interfaces? Have you looked at the example project
(instructions provided in the developer guide) to learn how to work with
the OCL API?

A basic working knowledge of EMF is definitely a pre-requisite to
working with this OCL implementation. There are numerous good resources
out there, including some documentation on the EMF website
(http://www.eclipse.org/modeling/emf/ ) and an excellent book.

On the subject of extents, I would recommend rather than trying to
search a specific resource for the extent of a class, instead searching
the entire ResourceSet. The context ("self") element of the OCL
expression evaluation is an EObject in a Resource. That Resource is in
a ResourceSet and provides access to all of the resources currently
loaded in it via the ResourceSet::getResources() method. So, you might
see what you can do by adapting the algorithm in the LazyExtentMap that
searches up the EObject tree stopping at the root element, to continue
upwards to the Resource that contains the root element (if any; see
EObject::eResource() API) and the ResourceSet containing that resource
(Resource::getResourceSet() method).

For more help on working with resources, resource sets, EObjects, and
the like, I refer you to the EMF newsgroup. These are not intrinsically
OCL questions.

HTH,

Christian

On Thu, 2009-05-07 at 18:29 +0000, Romulo Arpini wrote:

> No one? : (
>
> Christian, could you explain more detailed what you said in that another
> topic you mentioned?
>
> I tried that but I really have no idea about where to start.
>
> Please be patience because I am a beginner in EMF.
>
> I understand what you said that the scope of LazyExtentMap is only the
> resource of the context. But how can I 'change' this resource to the
> resource that I want to get all the instances?
>
> LazyExtentMap uses the context to get the resource, isnt it? So how will I
> get the other resource without the context?
>
> Sorry for my terrible english.
>
> And thank you very much.
>

--=-EcvSGgBodFNwCZdeQ2F0
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, Romulo,<BR>
<BR>
Have you read the OCL Developer Guide documentation and what it says about the relationship between the OCL parser/interpreter and the various environment interfaces?&nbsp; Have you looked at the example project (instructions provided in the developer guide) to learn how to work with the OCL API?<BR>
<BR>
A basic working knowledge of EMF is definitely a pre-requisite to working with this OCL implementation.&nbsp; There are numerous good resources out there, including some documentation on the EMF website (<A HREF="http://www.eclipse.org/modeling/emf/)">http://www.eclipse.org/modeling/emf/</A> ) and an excellent book.<BR>
<BR>
On the subject of extents, I would recommend rather than trying to search a specific resource for the extent of a class, instead searching the entire ResourceSet.&nbsp; The context (&quot;self&quot;) element of the OCL expression evaluation is an EObject in a Resource.&nbsp; That Resource is in a ResourceSet and provides access to all of the resources currently loaded in it via the ResourceSet::getResources() method.&nbsp; So, you might see what you can do by adapting the algorithm in the LazyExtentMap that searches up the EObject tree stopping at the root element, to continue upwards to the Resource that contains the root element (if any; see EObject::eResource() API) and the ResourceSet containing that resource (Resource::getResourceSet() method).<BR>
<BR>
For more help on working with resources, resource sets, EObjects, and the like, I refer you to the EMF newsgroup.&nbsp; These are not intrinsically OCL questions.<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
On Thu, 2009-05-07 at 18:29 +0000, Romulo Arpini wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
No one? : (

Christian, could you explain more detailed what you said in that another
topic you mentioned?

I tried that but I really have no idea about where to start.

Please be patience because I am a beginner in EMF.

I understand what you said that the scope of LazyExtentMap is only the
resource of the context. But how can I 'change' this resource to the
resource that I want to get all the instances?

LazyExtentMap uses the context to get the resource, isnt it? So how will I
get the other resource without the context?

Sorry for my terrible english.

And thank you very much.

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

--=-EcvSGgBodFNwCZdeQ2F0--
Previous Topic:stereotype constraints
Next Topic:Model validation, beginner question
Goto Forum:
  


Current Time: Thu Apr 25 00:52:59 GMT 2024

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

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

Back to the top