Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsClass.allInstances() does not work
https://www.eclipse.org/forums/index.php/mv/msg/312621/824233/#msg_824233
I have created Ecore programmatically and i am trying to instantiate it programmatically as well. I am using OCLSettingDelegateFactory.Global() delegates. But OCL expression 'TestClass.allInstances()' does not give instances of Type TestClass, it is always empty, do you have any idea why it is like that?
Do i need to use extentMap? if yes then how to to integrate extentMap?
Note: every OCL statement works perfectly except allInstances() operation.
Regards,
]]>ModelGeek Mising name2012-03-19T12:24:12-00:00Re: Class.allInstances() does not work
https://www.eclipse.org/forums/index.php/mv/msg/312621/824464/#msg_824464
allInstances() operates in some finite scope; which is the ExtentMap
passed to the constructor of EvaluatiinVisitorImpl. Check whether wht
you expect is in that ExtentMap and that it has the correct EClass.
Regards
Ed Willink
On 19/03/2012 08:24, ModelGeek Mising name wrote:
> Hi,
>
> I have created Ecore programmatically and i am trying to instantiate
> it programmatically as well, but OCL expression
> 'TestClass.allInstances()' does not give instances of Type TestClass,
> it is always empty, do you have any idea why it is like that?
>
> Note: every OCL statement works perfectly except allInstances()
> operation.
>
>
> Regards,
>
>]]>Ed Willink2012-03-19T17:47:10-00:00Re: Class.allInstances() does not work
https://www.eclipse.org/forums/index.php/mv/msg/312621/824560/#msg_824560
currently, i am evaluating using setting delegates, i am not using OCL facade.
Do i still need extent map?
As in documentation, example of OCL evaluation with OCL facade uses OCL.setExtentMap(map);
thanks for help.]]>ModelGeek Mising name2012-03-19T20:28:46-00:00Re: Class.allInstances() does not work
https://www.eclipse.org/forums/index.php/mv/msg/312621/824584/#msg_824584
As I wrote before (with typos)
allInstances() operates in some finite scope; which is the ExtentMap
passed to the constructor of EvaluationVisitorImpl. Check whether what
you expect is in that ExtentMap and that it has the correct EClass.
So yes you need the ExtentMap to provide all possible instances of all
possible classes, where 'all possible' is bounded by what you consider
appropriate for your application.
You are using the OCL facade, or rather the OCLSettingDelegate is using
it for you. It should be creating a LazyExtentMap that will use all
EObjects within the Resource of the EObject for which you use an
OCLSettingDelegate.
Have you ensured that all your EObjects are contained by a Resource,
which is contained by a ResourceSet? Many things in EMF go wrong if
EObjects are not fully contained.
Regards
Ed Willink
On 19/03/2012 16:28, ModelGeek Mising name wrote:
> At what scope allInstances() works? I am using it in an attribute
> derivation statement
> currently, i am evaluating using setting delegates, i am not using OCL
> facade.
> Do i still need extent map? As in documentation, example of OCL
> evaluation with OCL facade uses OCL.setExtentMap(map);
> thanks for help.]]>Ed Willink2012-03-19T21:04:26-00:00Re: Class.allInstances() does not work
https://www.eclipse.org/forums/index.php/mv/msg/312621/824932/#msg_824932
Axel Uhl2012-03-20T08:55:57-00:00Re: Class.allInstances() does not work
https://www.eclipse.org/forums/index.php/mv/msg/312621/824955/#msg_824955
EObjects were not contained by a Resource, now i update my code to have resource containing EObjects and it seems to work fine.
Actually i am also looking for minimum processing time as i have to make large number of instances for ecore and to save resource for each instance(xmi) of ecore to hard drive and to delete it afterwards will take processing time. Is there any way to do it without saving the resource?
Thanks for assistance!
Regards,
]]>ModelGeek Mising name2012-03-20T09:33:27-00:00Re: Class.allInstances() does not work
https://www.eclipse.org/forums/index.php/mv/msg/312621/824992/#msg_824992
I have figured it out and it is working fine.
thanks for assitance!
regards]]>ModelGeek Mising name2012-03-20T10:25:56-00:00Re: Class.allInstances() does not work
https://www.eclipse.org/forums/index.php/mv/msg/312621/825056/#msg_825056
I'm not sure I understand your comment; perhaps the subsequent message
supersedes it.
Putting all your EObjects in a Resource does not require you to actually
save the Resource to your hard drive.
Regards
Ed Willink
On 20/03/2012 05:33, ModelGeek Mising name wrote:
> Hi,
>
> EObjects were not contained by a Resource, now i update my code to
> have resource containing EObjects and it seems to work fine.
>
> Actually i am also looking for minimum processing time as i have to
> make large number of instances for ecore and to save resource for each
> instance(xmi) of ecore to hard drive and to delete it afterwards will
> take processing time. Is there any way to do it without saving the
> resource?
>
> Thanks for assistance!
>
> Regards,
>
>]]>Ed Willink2012-03-20T12:02:20-00:00Re: Class.allInstances() does not work
https://www.eclipse.org/forums/index.php/mv/msg/312621/825113/#msg_825113
Thanks!]]>ModelGeek Mising name2012-03-20T13:40:17-00:00