Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Query instances of abstract types
[CDO] Query instances of abstract types [message #649305] Tue, 18 January 2011 16:55 Go to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
I have an abstract super type of which multiple concrete types exist.
Now, how would I query CDO to return all instances of that abstract type?
Re: [CDO] Query instances of abstract types [message #649318 is a reply to message #649305] Tue, 18 January 2011 17:49 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Erdal,

at API level, you can use OCL to query the server. Take a look at
org.eclipse.emf.cdo.tests.OCLQueryTest, there are several examples on
how to do that:


CDOQuery query = transaction.createQuery("ocl",
"Product1.allInstances()", getModel1Package().getProduct1());

List<Product1> products = query.getResult(Product1.class);

However, if you are looking to achieve this through CDO UI, there isn't
any tooling for that yet, sorry.

HTH,
Víctor.


Erdal Karaca escribió:
> I have an abstract super type of which multiple concrete types exist.
> Now, how would I query CDO to return all instances of that abstract type?
Re: [CDO] Query instances of abstract types [message #649324 is a reply to message #649318] Tue, 18 January 2011 18:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 18.01.2011 18:49, schrieb Víctor Roldán Betancort:
> Erdal,
>
> at API level, you can use OCL to query the server. Take a look at org.eclipse.emf.cdo.tests.OCLQueryTest, there are several examples on how to do that:
>
>
> CDOQuery query = transaction.createQuery("ocl", "Product1.allInstances()", getModel1Package().getProduct1());
>
> List<Product1> products = query.getResult(Product1.class);
If you suspect a huge result set you may also call:

CloseableIterator<Product1> products = query.getResultAsync(Product1.class);

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



>
> However, if you are looking to achieve this through CDO UI, there isn't any tooling for that yet, sorry.
>
> HTH,
> Víctor.
>
>
> Erdal Karaca escribió:
>> I have an abstract super type of which multiple concrete types exist.
>> Now, how would I query CDO to return all instances of that abstract type?
>


Re: [CDO] Query instances of abstract types [message #649326 is a reply to message #649305] Tue, 18 January 2011 18:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Erdal,

There is a bug in OCL itself:

329389: allInstances suspect on Abstract classes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=329389

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 18.01.2011 17:55, schrieb Erdal Karaca:
> I have an abstract super type of which multiple concrete types exist.
> Now, how would I query CDO to return all instances of that abstract type?


Re: [CDO] Query instances of abstract types [message #649328 is a reply to message #649326] Tue, 18 January 2011 18:26 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 18.01.2011 19:21, schrieb Eike Stepper:
> Hi Erdal,
>
> There is a bug in OCL itself:
>
> 329389: allInstances suspect on Abstract classes
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329389
If you file an enhancement request against cdo.core someone may be able to add API like:

CDOView.queryInstances(EClass eClass, boolean includeSubClasses);
CDOView.queryInstancesAsync(EClass eClass, boolean includeSubClasses);

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Am 18.01.2011 17:55, schrieb Erdal Karaca:
>> I have an abstract super type of which multiple concrete types exist.
>> Now, how would I query CDO to return all instances of that abstract type?


Re: [CDO] Query instances of abstract types [message #649329 is a reply to message #649328] Tue, 18 January 2011 18:32 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
I actually have a query like that implemented, but only for DBStore. I
could contribute it if necessary.

Eike Stepper escribió:
> Am 18.01.2011 19:21, schrieb Eike Stepper:
>> Hi Erdal,
>>
>> There is a bug in OCL itself:
>>
>> 329389: allInstances suspect on Abstract classes
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329389
> If you file an enhancement request against cdo.core someone may be able
> to add API like:
>
> CDOView.queryInstances(EClass eClass, boolean includeSubClasses);
> CDOView.queryInstancesAsync(EClass eClass, boolean includeSubClasses);
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>> Am 18.01.2011 17:55, schrieb Erdal Karaca:
>>> I have an abstract super type of which multiple concrete types exist.
>>> Now, how would I query CDO to return all instances of that abstract
>>> type?
Re: [CDO] Query instances of abstract types [message #649347 is a reply to message #649329] Tue, 18 January 2011 20:31 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 18.01.2011 19:32, schrieb Víctor Roldán Betancort:
> I actually have a query like that implemented, but only for DBStore. I could contribute it if necessary.
Thank you, Vik! But this API would need to *supportable* by any store implementation. The way I have it in mind does even not require changes in the IStore SPI as we're already using similar functionality elsewhere.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> Eike Stepper escribió:
>> Am 18.01.2011 19:21, schrieb Eike Stepper:
>>> Hi Erdal,
>>>
>>> There is a bug in OCL itself:
>>>
>>> 329389: allInstances suspect on Abstract classes
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329389
>> If you file an enhancement request against cdo.core someone may be able
>> to add API like:
>>
>> CDOView.queryInstances(EClass eClass, boolean includeSubClasses);
>> CDOView.queryInstancesAsync(EClass eClass, boolean includeSubClasses);
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>
>>> Am 18.01.2011 17:55, schrieb Erdal Karaca:
>>>> I have an abstract super type of which multiple concrete types exist.
>>>> Now, how would I query CDO to return all instances of that abstract
>>>> type?
>


Re: [CDO] Query instances of abstract types [message #649400 is a reply to message #649347] Wed, 19 January 2011 06:59 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
Great, thanks!
Re: [CDO] Query instances of abstract types [message #649460 is a reply to message #649347] Wed, 19 January 2011 10:35 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
I see... I though the design would be similar to queryxref. I use IStore
dependant queries because it allows me to optimize, in the case of
DBStore, with simple SQL queries. I wonder if you could achieve a fast
IStore agnostic query. Looking forward to it :D

Thanks!
Víctor

Eike Stepper escribió:
> Am 18.01.2011 19:32, schrieb Víctor Roldán Betancort:
>> I actually have a query like that implemented, but only for DBStore. I
>> could contribute it if necessary.
> Thank you, Vik! But this API would need to *supportable* by any store
> implementation. The way I have it in mind does even not require changes
> in the IStore SPI as we're already using similar functionality elsewhere.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>>
>> Eike Stepper escribió:
>>> Am 18.01.2011 19:21, schrieb Eike Stepper:
>>>> Hi Erdal,
>>>>
>>>> There is a bug in OCL itself:
>>>>
>>>> 329389: allInstances suspect on Abstract classes
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329389
>>> If you file an enhancement request against cdo.core someone may be able
>>> to add API like:
>>>
>>> CDOView.queryInstances(EClass eClass, boolean includeSubClasses);
>>> CDOView.queryInstancesAsync(EClass eClass, boolean includeSubClasses);
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>
>>>> Am 18.01.2011 17:55, schrieb Erdal Karaca:
>>>>> I have an abstract super type of which multiple concrete types exist.
>>>>> Now, how would I query CDO to return all instances of that abstract
>>>>> type?
>>
Re: [CDO] Query instances of abstract types [message #649469 is a reply to message #649460] Wed, 19 January 2011 11:18 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 19.01.2011 11:35, schrieb Víctor Roldán Betancort:
> I see... I though the design would be similar to queryxref. I use IStore dependant queries because it allows me to optimize, in the case of DBStore, with simple SQL queries. I wonder if you could achieve a fast IStore agnostic query. Looking forward to it :D
It would be based on IStoreAccessor.handleRevisions(EClass, CDOBranch, long, boolean, CDORevisionHandler)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> Thanks!
> Víctor
>
> Eike Stepper escribió:
>> Am 18.01.2011 19:32, schrieb Víctor Roldán Betancort:
>>> I actually have a query like that implemented, but only for DBStore. I
>>> could contribute it if necessary.
>> Thank you, Vik! But this API would need to *supportable* by any store
>> implementation. The way I have it in mind does even not require changes
>> in the IStore SPI as we're already using similar functionality elsewhere.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>>
>>> Eike Stepper escribió:
>>>> Am 18.01.2011 19:21, schrieb Eike Stepper:
>>>>> Hi Erdal,
>>>>>
>>>>> There is a bug in OCL itself:
>>>>>
>>>>> 329389: allInstances suspect on Abstract classes
>>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=329389
>>>> If you file an enhancement request against cdo.core someone may be able
>>>> to add API like:
>>>>
>>>> CDOView.queryInstances(EClass eClass, boolean includeSubClasses);
>>>> CDOView.queryInstancesAsync(EClass eClass, boolean includeSubClasses);
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://www.esc-net.de
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>
>>>>>
>>>>> Am 18.01.2011 17:55, schrieb Erdal Karaca:
>>>>>> I have an abstract super type of which multiple concrete types exist.
>>>>>> Now, how would I query CDO to return all instances of that abstract
>>>>>> type?
>>>
>


Previous Topic:[CDO] EClass id
Next Topic:EMF-GWT: a dedicated forum?
Goto Forum:
  


Current Time: Thu Apr 25 07:05:48 GMT 2024

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

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

Back to the top