You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Dan Diephouse <da...@mulesource.com> on 2007/12/20 21:31:07 UTC

Complex Queries

I'm struggling a little bit to understand how to do a more complex 
query. Let say I have a model like this:

/blog
/blog/name = "Dan's Blog"
/blog/author = "Dan Diephouse"
/blog/entry
/blog/entry/title = "Jackrabbit"
/blog/entry/content ....

I want to do a query where I select the blog node where /entry/title = 
"Jackrabbit" OR /blog/author = "Dan Diephouse"

In my own perverted SQL syntax: select /blog  where author = "Dan 
Diephouse" or entry/title = "Jackrabbit"

I don't see how it's possible to create an SQL syntax where you test for 
properties both on the node you're selecting and on it's child though. 
Can anyone enlighten me?

Thanks,
- Dan

-- 
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog


Re: PostgreSQLPersistenceManager

Posted by hanasaki jiji <ha...@gmail.com>.
Anyone have performance / benchmark specs on derby, postgres, mysql etc... ?

On Dec 21, 2007 4:28 AM, Stefan Guggisberg <st...@gmail.com> wrote:
> On Dec 21, 2007 10:30 AM, Simon Jentzsch <si...@yahoo.de> wrote:
> > hi,
> >
> > I'm trying find a fast and reliable Database for Persitance, because I
> > have worked with the the postgres for the last 7 years and never been
> > disapointed, so I wanted to use the postgres-bundle. On the Wiki-Docu I
> > read about the PostgreSQLPersistenceManager, but it does not seem to be
> > included in the 1.3.3. When will this be available?
> > Or if somebody could suggest me a better PersistanceManager ( I'm trying
> > to manage about 5 GB of different Binary-Data along with free Metadata).
>
> i'd suggest you give derby (jackrabbit's current default configuration) a try.
>
> cheers
> stefan
>
>
> >
> > Thanx..
> >
> >
> > ___________
> > simon jentzsch
> >
> >
> >
> > ___________________________________________________________
> > Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
> >
>

Re: PostgreSQLPersistenceManager

Posted by Stefan Guggisberg <st...@gmail.com>.
On Dec 21, 2007 10:30 AM, Simon Jentzsch <si...@yahoo.de> wrote:
> hi,
>
> I'm trying find a fast and reliable Database for Persitance, because I
> have worked with the the postgres for the last 7 years and never been
> disapointed, so I wanted to use the postgres-bundle. On the Wiki-Docu I
> read about the PostgreSQLPersistenceManager, but it does not seem to be
> included in the 1.3.3. When will this be available?
> Or if somebody could suggest me a better PersistanceManager ( I'm trying
> to manage about 5 GB of different Binary-Data along with free Metadata).

i'd suggest you give derby (jackrabbit's current default configuration) a try.

cheers
stefan

>
> Thanx..
>
>
> ___________
> simon jentzsch
>
>
>
> ___________________________________________________________
> Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
>

Re: PostgreSQLPersistenceManager

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

PostgreSQLPersistenceManager is included in the current trunk and will be
available in Jackrabbit 1.4 (due very early next year). If you want to try
this year, you need to compile Jackrabbit yourself.

Or if somebody could suggest me a better PersistanceManager ( I'm trying
> to manage about 5 GB of different Binary-Data along with free Metadata).


With Jackrabbit 1.4, should should also consider using the Global Data
Store, see http://wiki.apache.org/jackrabbit/DataStore

Regards,
Thomas

PostgreSQLPersistenceManager

Posted by Simon Jentzsch <si...@yahoo.de>.
hi,

I'm trying find a fast and reliable Database for Persitance, because I 
have worked with the the postgres for the last 7 years and never been 
disapointed, so I wanted to use the postgres-bundle. On the Wiki-Docu I 
read about the PostgreSQLPersistenceManager, but it does not seem to be 
included in the 1.3.3. When will this be available?
Or if somebody could suggest me a better PersistanceManager ( I'm trying 
to manage about 5 GB of different Binary-Data along with free Metadata).

Thanx..


___________
simon jentzsch

	
		
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

RE: Complex Queries

Posted by Ard Schrijvers <a....@hippo.nl>.
Hello Dan,

> 
> I'm struggling a little bit to understand how to do a more 
> complex query. Let say I have a model like this:
> 
> /blog
> /blog/name = "Dan's Blog"
> /blog/author = "Dan Diephouse"
> /blog/entry
> /blog/entry/title = "Jackrabbit"
> /blog/entry/content ....
> 
> I want to do a query where I select the blog node where 
> /entry/title = "Jackrabbit" OR /blog/author = "Dan Diephouse"
> 
> In my own perverted SQL syntax: select /blog  where author = 
> "Dan Diephouse" or entry/title = "Jackrabbit"

I haven't done much with SQL syntax (XPATH normally) but I think this
one doesn't look right. Take a look at SimpleQueryTest in
o.a.j.core.query. There are a lot of sql examples there that should get
you started. Reading '8.5.1 The SQL Language' from jsr-170 might also
help you understand the syntax (about 10 pages only)

Regards ARd

> 
> I don't see how it's possible to create an SQL syntax where 
> you test for properties both on the node you're selecting and 
> on it's child though. 
> Can anyone enlighten me?
> 
> Thanks,
> - Dan
> 
> --
> Dan Diephouse
> MuleSource
> http://mulesource.com | http://netzooid.com/blog
> 
> 

Re: Complex Queries

Posted by Alexandru Popescu ☀ <th...@gmail.com>.
On Jan 8, 2008 8:03 AM, Dan Diephouse <da...@mulesource.com> wrote:
>
> Marcel Reutegger wrote:
> > Dan Diephouse wrote:
> >> Going to throw a wrench in the mix.  Is it possible to do something
> >> like this:
> >>
> >> /blog/entry[@title='Jackrabbit' or ../@author='Dan Diephouse']
> >
> > no, the parent axis is currently not supported. if there was an and in
> > your predicate you could write:
> >
> > /blog[@author='Dan Diephouse']/entry[@title='Jackrabbit']
> >
> > regards
> >  marcel
> Well thats a bummer. I will have to file a JIRA. How hard would it be to
> implement such a feature?
>

Dan, I don't have a spec close to me, but I think this is not
specified in it. I do agree though that having an implementation
specific stuff is still better than nothing :).

./alex
--
.w( the_mindstorm )p.

PS: All the best for the new year!
>
> - Dan
>
> --
> Dan Diephouse
> MuleSource
> http://mulesource.com | http://netzooid.com/blog
>
>

Re: Complex Queries

Posted by Marcel Reutegger <ma...@gmx.net>.
Dan Diephouse wrote:
> Well thats a bummer. I will have to file a JIRA.

please do so.

> How hard would it be to 
> implement such a feature?

it's probably not that difficult, but I didn't have a closer look at it.

regards
  marcel

Re: Complex Queries

Posted by Dan Diephouse <da...@mulesource.com>.
Marcel Reutegger wrote:
> Dan Diephouse wrote:
>> Going to throw a wrench in the mix.  Is it possible to do something 
>> like this:
>>
>> /blog/entry[@title='Jackrabbit' or ../@author='Dan Diephouse']
>
> no, the parent axis is currently not supported. if there was an and in 
> your predicate you could write:
>
> /blog[@author='Dan Diephouse']/entry[@title='Jackrabbit']
>
> regards
>  marcel
Well thats a bummer. I will have to file a JIRA. How hard would it be to 
implement such a feature?

- Dan

-- 
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog


Re: Complex Queries

Posted by Marcel Reutegger <ma...@gmx.net>.
Dan Diephouse wrote:
> Going to throw a wrench in the mix.  Is it possible to do something like 
> this:
> 
> /blog/entry[@title='Jackrabbit' or ../@author='Dan Diephouse']

no, the parent axis is currently not supported. if there was an and in your 
predicate you could write:

/blog[@author='Dan Diephouse']/entry[@title='Jackrabbit']

regards
  marcel

Re: Complex Queries

Posted by Dan Diephouse <da...@mulesource.com>.
Dan Diephouse wrote:
> Marcel Reutegger wrote:
>> Dan Diephouse wrote:
>>> I don't see how it's possible to create an SQL syntax where you test 
>>> for properties both on the node you're selecting and on it's child 
>>> though. Can anyone enlighten me?
>>
>> that's not possible using SQL. JSR 170 does not specify how 
>> properties of a child node can be used in a predicate. you have to 
>> write a XPath statement:
>>
>> blog[@author = 'Dan Diephouse' or entry/@title = 'Jackrabbit']
>>
>> regards
>>  marcel
> Cool, thanks Marcel.
>
> Going to throw a wrench in the mix.  Is it possible to do something 
> like this:
>
> /blog/entry[@title='Jackrabbit' or ../@author='Dan Diephouse']
>
> As I apply this to may app I'm realizing its not actually the "blog" 
> node I want to select, its the "entry" node. (This is a contrived 
> example, I swear there is an actual non contrived usage for this in  
> my app).
>
> - Dan
>
FYI, I tried both the above and using "parent::node()/@author..." and 
neither worked.

- Dan

-- 
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog


Re: Complex Queries

Posted by Dan Diephouse <da...@mulesource.com>.
Marcel Reutegger wrote:
> Dan Diephouse wrote:
>> I don't see how it's possible to create an SQL syntax where you test 
>> for properties both on the node you're selecting and on it's child 
>> though. Can anyone enlighten me?
>
> that's not possible using SQL. JSR 170 does not specify how properties 
> of a child node can be used in a predicate. you have to write a XPath 
> statement:
>
> blog[@author = 'Dan Diephouse' or entry/@title = 'Jackrabbit']
>
> regards
>  marcel
Cool, thanks Marcel.

Going to throw a wrench in the mix.  Is it possible to do something like 
this:

/blog/entry[@title='Jackrabbit' or ../@author='Dan Diephouse']

As I apply this to may app I'm realizing its not actually the "blog" 
node I want to select, its the "entry" node. (This is a contrived 
example, I swear there is an actual non contrived usage for this in  my 
app).

- Dan

-- 
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog


Re: Complex Queries

Posted by Marcel Reutegger <ma...@gmx.net>.
Dan Diephouse wrote:
> I don't see how it's possible to create an SQL syntax where you test for 
> properties both on the node you're selecting and on it's child though. 
> Can anyone enlighten me?

that's not possible using SQL. JSR 170 does not specify how properties of a 
child node can be used in a predicate. you have to write a XPath statement:

blog[@author = 'Dan Diephouse' or entry/@title = 'Jackrabbit']

regards
  marcel

Re: Complex Queries

Posted by Alexandru Popescu ☀ <th...@gmail.com>.
On Dec 20, 2007 10:31 PM, Dan Diephouse <da...@mulesource.com> wrote:
> I'm struggling a little bit to understand how to do a more complex
> query. Let say I have a model like this:
>
> /blog
> /blog/name = "Dan's Blog"
> /blog/author = "Dan Diephouse"
> /blog/entry
> /blog/entry/title = "Jackrabbit"
> /blog/entry/content ....
>
> I want to do a query where I select the blog node where /entry/title =
> "Jackrabbit" OR /blog/author = "Dan Diephouse"
>
> In my own perverted SQL syntax: select /blog  where author = "Dan
> Diephouse" or entry/title = "Jackrabbit"
>
> I don't see how it's possible to create an SQL syntax where you test for
> properties both on the node you're selecting and on it's child though.
> Can anyone enlighten me?
>
> Thanks,
> - Dan
>
> --
> Dan Diephouse
> MuleSource
> http://mulesource.com | http://netzooid.com/blog
>
>

Hi Dan!

I don't think it will work in this format. I guess the only way to get
this working is by using a query based on the node type (in case both
/blog and /blog/entry share the same type or at least mixin) and then
your query (XPath query) will be something like:

//element(*, <common_type_or_mixin>)[@author='' OR @title='']

(this suggestions comes with no guarantees ;-), as I haven't tried it).

./alex
--
.w( the_mindstorm )p.