Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Querying a single resource with CDOQuery
[CDO] Querying a single resource with CDOQuery [message #730476] Wed, 28 September 2011 13:35 Go to next message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 17
Registered: September 2011
Junior Member
Hello.

I have several models stored in CDO 4.0 over MySQL and I want to use CDOQuery to query each of them separately. However, I cannot find a way to execute a CDOQuery over a single resource, it just queries the whole repository.

Is there any way to do this?

Thanks in advance.
Re: [CDO] Querying a single resource with CDOQuery [message #730575 is a reply to message #730476] Wed, 28 September 2011 16:15 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 28.09.2011 15:35, schrieb inbasswetrust:
> Hello.
>
> I have several models stored in CDO 4.0 over MySQL and I want to use CDOQuery to query each of them separately.
> However, I cannot find a way to execute a CDOQuery over a single resource, it just queries the whole repository.
What query language are you using? SQL? OCL?

In general this "subtree constraint" is hard to implement for huge trees, impossible to do it efficiently (without
locking almost the entire repository exclusively, on each access!).

In SQL there probably no language construct available to express the recursivity. In OCL it *could* be possible. I'm not
a particular expert in any of these languages.

A workaround could be to copy the resource in question to a non-CDO resource for the time of the query (use prefetching
in this case!).

Cheers
/Eike

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


Re: [CDO] Querying a single resource with CDOQuery [message #730577 is a reply to message #730476] Wed, 28 September 2011 16:15 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 28.09.2011 15:35, schrieb inbasswetrust:
> Hello.
>
> I have several models stored in CDO 4.0 over MySQL and I want to use CDOQuery to query each of them separately.
> However, I cannot find a way to execute a CDOQuery over a single resource, it just queries the whole repository.
What query language are you using? SQL? OCL?

In general this "subtree constraint" is hard to implement for huge trees, impossible to do it efficiently (without
locking almost the entire repository exclusively, on each access!).

In SQL there probably no language construct available to express the recursivity. In OCL it *could* be possible. I'm not
a particular expert in any of these languages.

A workaround could be to copy the resource in question to a non-CDO resource for the time of the query (use prefetching
in this case!).

Cheers
/Eike

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


Re: [CDO] Querying a single resource with CDOQuery [message #730968 is a reply to message #730575] Thu, 29 September 2011 15:56 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 17
Registered: September 2011
Junior Member
Hello Eike.

Using both SQL and OCL, if I want to request all instances of an eclass contained by a single resource (model), it can't be done: it returns all the instances of that eclass contained by all the resources.

[Updated on: Thu, 29 September 2011 16:00]

Report message to a moderator

Re: [CDO] Querying a single resource with CDOQuery [message #730983 is a reply to message #730575] Thu, 29 September 2011 15:56 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 17
Registered: September 2011
Junior Member
Hello Eike.

Using both SQL and OCL, if I want to request all instances of an eclass contained by a single resource (model), it can be done: it returns all the instances of all the resources.
Re: [CDO] Querying a single resource with CDOQuery [message #730999 is a reply to message #730968] Thu, 29 September 2011 16:44 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 29.09.2011 17:56, schrieb inbasswetrust:
> Hello Eike.
>
> Using both SQL and OCL, if I want to request all instances of an eclass contained by a single resource (model), it can
> be done: it returns all the instances of all the resources.
Excellent ;-)

Cheers
/Eike

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


Re: [CDO] Querying a single resource with CDOQuery [message #731032 is a reply to message #730476] Thu, 29 September 2011 18:31 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing nameFriend
Messages: 17
Registered: September 2011
Junior Member
Sorry, that was a typo. I meant that it can not load all the instances of an eclass contained in a single model where there are more than one model in the repository.

[Updated on: Thu, 29 September 2011 18:31]

Report message to a moderator

Re: [CDO] Querying a single resource with CDOQuery [message #731063 is a reply to message #731032] Thu, 29 September 2011 19:13 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 29.09.2011 20:31, schrieb inbasswetrust:
> Sorry, that was a type. I meant that it can not load all the instances of an eclass contained in a single model where
> there are more than one model in the repository.
It's hard to imagine that OCL does not support to constrain results by Resource. But I already said tat I'm not an OCL
expert ;-(

Cheers
/Eike

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


Re: [CDO] Querying a single resource with CDOQuery [message #731244 is a reply to message #730577] Fri, 30 September 2011 11:29 Go to previous message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
Eike Stepper wrote on Wed, 28 September 2011 12:15
In SQL there probably no language construct available to express the recursivity.


Not sure of other SQL databases, but Oracle allows for recursion (START WITH... CONNECT BY...), i.e. traverse a "graph" recursively...
Previous Topic:Custom EMF JetTemplates: Uses wrong compiled template
Next Topic:XSD import: creating base packages
Goto Forum:
  


Current Time: Fri Apr 26 02:50:29 GMT 2024

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

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

Back to the top