Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-31 Thread Ricardo.Julio.Rodriguez.Fernandez
Thanks!

Here you have our very small contribution...

http://extensions.xwiki.org/xwiki/bin/view/Extension/XWQL+Query+on+comments

Thanks for your work and your help!


From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
Massol [vinc...@massol.net]
Sent: 31 May 2013 16:20
To: XWiki Users
Cc: Lista Garcia, Isabel
Subject: Re: [xwiki-users] XWQL query on several objects of the same class  
instantiated in the same doc

On May 31, 2013, at 10:50 AM, ricardo.julio.rodriguez.fernan...@sergas.es wrote:

> Thanks  Vincent! The evil were in the XWQL sentence: it read ':string1' 
> instead of :string1.
>
> Could it be useful to add an XWQL sentence example to the Query Module page 
> or a link to a page explaining the syntax to avoid this kind of errors?

Done, see http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module

Thanks
-Vincent

>
> http://www.idisantiago.es/bin/XWQL/QueryOnComments
>
> I'll copy it to the snippet's repository ASAP!
>
> Cheers!
>
> Ricardo
>
>
> 
> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
> Massol [vinc...@massol.net]
> Sent: 31 May 2013 09:26
> To: XWiki Users
> Cc: Lista Garcia, Isabel
> Subject: Re: [xwiki-users] XWQL query on several objects of the same class
>   instantiated in the same doc
>
> Try this:
>
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
> comm2.comment LIKE :string1")
> #set ($results = 
> $services.query.xwql($xwqlquery).bindValue("string1","test").execute())
>
> Thanks
> -Vincent
>
> On May 31, 2013, at 9:14 AM,  
> wrote:
>
>> Hi Vicent!
>>
>> Sorry for top-replying, but this email client is a PITA!
>>
>> Something else must be failing, this alternatives don't work neither:
>>
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
>> comm2.comment LIKE ':string1'")
>> #set ($results = 
>> $services.query.xwql($xwqlquery).bindValue("string1",$string1).execute())
>>
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
>> comm2.comment LIKE ':string1'")
>> #set ($results = 
>> $services.query.xwql($xwqlquery).bindValue("string1",'$string1').execute())
>>
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
>> comm2.comment LIKE ':string1'")
>> #set ($results = 
>> $services.query.xwql($xwqlquery).bindValue("string1","$string1").execute())
>>
>> I always get the same error...
>>
>> Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception 
>> while hibernate execute
>> Wrapped Exception: could not locate named parameter [string1]
>>
>> Any idea will be welcome!
>>
>> Thanks!
>>
>> 
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
>> Massol [vinc...@massol.net]
>> Sent: 31 May 2013 08:15
>> To: XWiki Users
>> Cc: Lista Garcia, Isabel
>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class   
>>instantiated in the same doc
>>
>> Hi Ricardo,
>>
>> On May 30, 2013, at 10:54 PM, ricardo.julio.rodriguez.fernan...@sergas.es 
>> wrote:
>>
>>> Hi Vicent!
>>>
>>>> 
>>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>>> Vincent Massol [vinc...@massol.net]
>>>> Sent: 28 May 2013 08:45
>>>> To: XWiki Users
>>>> Cc: Lista Garcia, Isabel
>>>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
>>>>  instantiated in the same doc
>>>>
>>>> Hi Ricardo,
>>>>
>>>> On May 28, 2013, at 7:35 AM,  
>>>> wrote:
>>>>
>>>>> Hi Vincent, all!
>>>>>
>>>>> Please, do you think this is of any value and clear enough as to going to 
>>>>> XWiki Extensions Query Module page?
>>>>>
>>>>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
>>>>
>>>>

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-31 Thread Vincent Massol

On May 31, 2013, at 10:50 AM, ricardo.julio.rodriguez.fernan...@sergas.es wrote:

> Thanks  Vincent! The evil were in the XWQL sentence: it read ':string1' 
> instead of :string1.
> 
> Could it be useful to add an XWQL sentence example to the Query Module page 
> or a link to a page explaining the syntax to avoid this kind of errors?

Done, see http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module

Thanks
-Vincent

> 
> http://www.idisantiago.es/bin/XWQL/QueryOnComments
> 
> I'll copy it to the snippet's repository ASAP!
> 
> Cheers!
> 
> Ricardo
> 
> 
> 
> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
> Massol [vinc...@massol.net]
> Sent: 31 May 2013 09:26
> To: XWiki Users
> Cc: Lista Garcia, Isabel
> Subject: Re: [xwiki-users] XWQL query on several objects of the same class
>   instantiated in the same doc
> 
> Try this:
> 
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
> comm2.comment LIKE :string1")
> #set ($results = 
> $services.query.xwql($xwqlquery).bindValue("string1","test").execute())
> 
> Thanks
> -Vincent
> 
> On May 31, 2013, at 9:14 AM,  
> wrote:
> 
>> Hi Vicent!
>> 
>> Sorry for top-replying, but this email client is a PITA!
>> 
>> Something else must be failing, this alternatives don't work neither:
>> 
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
>> comm2.comment LIKE ':string1'")
>> #set ($results = 
>> $services.query.xwql($xwqlquery).bindValue("string1",$string1).execute())
>> 
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
>> comm2.comment LIKE ':string1'")
>> #set ($results = 
>> $services.query.xwql($xwqlquery).bindValue("string1",'$string1').execute())
>> 
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
>> comm2.comment LIKE ':string1'")
>> #set ($results = 
>> $services.query.xwql($xwqlquery).bindValue("string1","$string1").execute())
>> 
>> I always get the same error...
>> 
>> Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception 
>> while hibernate execute
>> Wrapped Exception: could not locate named parameter [string1]
>> 
>> Any idea will be welcome!
>> 
>> Thanks!
>> 
>> 
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
>> Massol [vinc...@massol.net]
>> Sent: 31 May 2013 08:15
>> To: XWiki Users
>> Cc: Lista Garcia, Isabel
>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class   
>>instantiated in the same doc
>> 
>> Hi Ricardo,
>> 
>> On May 30, 2013, at 10:54 PM, ricardo.julio.rodriguez.fernan...@sergas.es 
>> wrote:
>> 
>>> Hi Vicent!
>>> 
>>>> 
>>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>>> Vincent Massol [vinc...@massol.net]
>>>> Sent: 28 May 2013 08:45
>>>> To: XWiki Users
>>>> Cc: Lista Garcia, Isabel
>>>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
>>>>  instantiated in the same doc
>>>> 
>>>> Hi Ricardo,
>>>> 
>>>> On May 28, 2013, at 7:35 AM,  
>>>> wrote:
>>>> 
>>>>> Hi Vincent, all!
>>>>> 
>>>>> Please, do you think this is of any value and clear enough as to going to 
>>>>> XWiki Extensions Query Module page?
>>>>> 
>>>>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
>>>> 
>>>> Yes it would be great to add this to extensions.xwiki.org :)
>>>> 
>>>> Since it's not a single query I'm not sure the best place is the query 
>>>> module page.
>>>> 
>>>> I'd say that it could be added as an entire snippet on 
>>>> extensions.xwiki.org.
>>>> 
>>>> Important Note: Your code is written dangerously and is subject to XSS 
>>>&

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-31 Thread Ricardo.Julio.Rodriguez.Fernandez
Thanks  Vincent! The evil were in the XWQL sentence: it read ':string1' instead 
of :string1.

Could it be useful to add an XWQL sentence example to the Query Module page or 
a link to a page explaining the syntax to avoid this kind of errors?

http://www.idisantiago.es/bin/XWQL/QueryOnComments

I'll copy it to the snippet's repository ASAP!

Cheers!

Ricardo



From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
Massol [vinc...@massol.net]
Sent: 31 May 2013 09:26
To: XWiki Users
Cc: Lista Garcia, Isabel
Subject: Re: [xwiki-users] XWQL query on several objects of the same class      
instantiated in the same doc

Try this:

#set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
comm2.comment LIKE :string1")
#set ($results = 
$services.query.xwql($xwqlquery).bindValue("string1","test").execute())

Thanks
-Vincent

On May 31, 2013, at 9:14 AM,  
wrote:

> Hi Vicent!
>
> Sorry for top-replying, but this email client is a PITA!
>
> Something else must be failing, this alternatives don't work neither:
>
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
> comm2.comment LIKE ':string1'")
> #set ($results = 
> $services.query.xwql($xwqlquery).bindValue("string1",$string1).execute())
>
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
> comm2.comment LIKE ':string1'")
> #set ($results = 
> $services.query.xwql($xwqlquery).bindValue("string1",'$string1').execute())
>
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
> comm2.comment LIKE ':string1'")
> #set ($results = 
> $services.query.xwql($xwqlquery).bindValue("string1","$string1").execute())
>
> I always get the same error...
>
> Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while 
> hibernate execute
> Wrapped Exception: could not locate named parameter [string1]
>
> Any idea will be welcome!
>
> Thanks!
>
> ____________________
> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
> Massol [vinc...@massol.net]
> Sent: 31 May 2013 08:15
> To: XWiki Users
> Cc: Lista Garcia, Isabel
> Subject: Re: [xwiki-users] XWQL query on several objects of the same class
>   instantiated in the same doc
>
> Hi Ricardo,
>
> On May 30, 2013, at 10:54 PM, ricardo.julio.rodriguez.fernan...@sergas.es 
> wrote:
>
>> Hi Vicent!
>>
>>> ________________
>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>> Vincent Massol [vinc...@massol.net]
>>> Sent: 28 May 2013 08:45
>>> To: XWiki Users
>>> Cc: Lista Garcia, Isabel
>>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class  
>>> instantiated in the same doc
>>>
>>> Hi Ricardo,
>>>
>>> On May 28, 2013, at 7:35 AM,  
>>> wrote:
>>>
>>>> Hi Vincent, all!
>>>>
>>>> Please, do you think this is of any value and clear enough as to going to 
>>>> XWiki Extensions Query Module page?
>>>>
>>>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
>>>
>>> Yes it would be great to add this to extensions.xwiki.org :)
>>>
>>> Since it's not a single query I'm not sure the best place is the query 
>>> module page.
>>>
>>> I'd say that it could be added as an entire snippet on extensions.xwiki.org.
>>>
>>> Important Note: Your code is written dangerously and is subject to XSS 
>>> attacks. You need to modify it and use binding:
>>>
>>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>>> doc2.object(XWiki.XWikiComments) comm2
>>> WHERE doc2.translation = 0 and comm2.comment LIKE '$string1'")
>>>
>>> should be:
>>>
>>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>>> doc2.object(XWiki.XWikiComments) comm2
>>> WHERE doc2.translation = 0 and comm2.comment LIKE ':string1'")
>>>
>>
>> Thanks for the note, Vicent! I've already tried that, but I was not able to 
>> solve this error:
>>
>> Caused by: c

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-31 Thread Vincent Massol
See also
http://playground.xwiki.org/xwiki/bin/view/Main/Vincent

Thanks
-Vincent

On May 31, 2013, at 9:26 AM, Vincent Massol  wrote:

> Try this:
> 
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
> comm2.comment LIKE :string1")
> #set ($results = 
> $services.query.xwql($xwqlquery).bindValue("string1","test").execute())
> 
> Thanks
> -Vincent
> 
> On May 31, 2013, at 9:14 AM,  
> wrote:
> 
>> Hi Vicent!
>> 
>> Sorry for top-replying, but this email client is a PITA!
>> 
>> Something else must be failing, this alternatives don't work neither:
>> 
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
>> comm2.comment LIKE ':string1'")
>> #set ($results = 
>> $services.query.xwql($xwqlquery).bindValue("string1",$string1).execute())
>> 
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
>> comm2.comment LIKE ':string1'")
>> #set ($results = 
>> $services.query.xwql($xwqlquery).bindValue("string1",'$string1').execute())
>> 
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
>> comm2.comment LIKE ':string1'")
>> #set ($results = 
>> $services.query.xwql($xwqlquery).bindValue("string1","$string1").execute())
>> 
>> I always get the same error...
>> 
>> Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception 
>> while hibernate execute
>> Wrapped Exception: could not locate named parameter [string1]
>> 
>> Any idea will be welcome!
>> 
>> Thanks!
>> 
>> 
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
>> Massol [vinc...@massol.net]
>> Sent: 31 May 2013 08:15
>> To: XWiki Users
>> Cc: Lista Garcia, Isabel
>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class   
>>    instantiated in the same doc
>> 
>> Hi Ricardo,
>> 
>> On May 30, 2013, at 10:54 PM, ricardo.julio.rodriguez.fernan...@sergas.es 
>> wrote:
>> 
>>> Hi Vicent!
>>> 
>>>> 
>>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>>> Vincent Massol [vinc...@massol.net]
>>>> Sent: 28 May 2013 08:45
>>>> To: XWiki Users
>>>> Cc: Lista Garcia, Isabel
>>>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
>>>>  instantiated in the same doc
>>>> 
>>>> Hi Ricardo,
>>>> 
>>>> On May 28, 2013, at 7:35 AM,  
>>>> wrote:
>>>> 
>>>>> Hi Vincent, all!
>>>>> 
>>>>> Please, do you think this is of any value and clear enough as to going to 
>>>>> XWiki Extensions Query Module page?
>>>>> 
>>>>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
>>>> 
>>>> Yes it would be great to add this to extensions.xwiki.org :)
>>>> 
>>>> Since it's not a single query I'm not sure the best place is the query 
>>>> module page.
>>>> 
>>>> I'd say that it could be added as an entire snippet on 
>>>> extensions.xwiki.org.
>>>> 
>>>> Important Note: Your code is written dangerously and is subject to XSS 
>>>> attacks. You need to modify it and use binding:
>>>> 
>>>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>>>> doc2.object(XWiki.XWikiComments) comm2
>>>> WHERE doc2.translation = 0 and comm2.comment LIKE '$string1'")
>>>> 
>>>> should be:
>>>> 
>>>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>>>> doc2.object(XWiki.XWikiComments) comm2
>>>> WHERE doc2.translation = 0 and comm2.comment LIKE ':string1'")
>>>> 
>>> 
>>> Thanks for the note, Vicent! I've already tried that, but I was not able to 
>>> solve this error:
>>> 
>>> Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception 
>>

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-31 Thread Vincent Massol
Try this:

#set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
comm2.comment LIKE :string1")
#set ($results = 
$services.query.xwql($xwqlquery).bindValue("string1","test").execute())

Thanks
-Vincent

On May 31, 2013, at 9:14 AM,  
wrote:

> Hi Vicent!
> 
> Sorry for top-replying, but this email client is a PITA!
> 
> Something else must be failing, this alternatives don't work neither:
> 
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
> comm2.comment LIKE ':string1'")
> #set ($results = 
> $services.query.xwql($xwqlquery).bindValue("string1",$string1).execute())
> 
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
> comm2.comment LIKE ':string1'")
> #set ($results = 
> $services.query.xwql($xwqlquery).bindValue("string1",'$string1').execute())
> 
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
> comm2.comment LIKE ':string1'")
> #set ($results = 
> $services.query.xwql($xwqlquery).bindValue("string1","$string1").execute())
> 
> I always get the same error...
> 
> Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while 
> hibernate execute
> Wrapped Exception: could not locate named parameter [string1]
> 
> Any idea will be welcome!
> 
> Thanks!
> 
> ________________________
> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
> Massol [vinc...@massol.net]
> Sent: 31 May 2013 08:15
> To: XWiki Users
> Cc: Lista Garcia, Isabel
> Subject: Re: [xwiki-users] XWQL query on several objects of the same class
>   instantiated in the same doc
> 
> Hi Ricardo,
> 
> On May 30, 2013, at 10:54 PM, ricardo.julio.rodriguez.fernan...@sergas.es 
> wrote:
> 
>> Hi Vicent!
>> 
>>> ________________
>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>> Vincent Massol [vinc...@massol.net]
>>> Sent: 28 May 2013 08:45
>>> To: XWiki Users
>>> Cc: Lista Garcia, Isabel
>>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class  
>>> instantiated in the same doc
>>> 
>>> Hi Ricardo,
>>> 
>>> On May 28, 2013, at 7:35 AM,  
>>> wrote:
>>> 
>>>> Hi Vincent, all!
>>>> 
>>>> Please, do you think this is of any value and clear enough as to going to 
>>>> XWiki Extensions Query Module page?
>>>> 
>>>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
>>> 
>>> Yes it would be great to add this to extensions.xwiki.org :)
>>> 
>>> Since it's not a single query I'm not sure the best place is the query 
>>> module page.
>>> 
>>> I'd say that it could be added as an entire snippet on extensions.xwiki.org.
>>> 
>>> Important Note: Your code is written dangerously and is subject to XSS 
>>> attacks. You need to modify it and use binding:
>>> 
>>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>>> doc2.object(XWiki.XWikiComments) comm2
>>> WHERE doc2.translation = 0 and comm2.comment LIKE '$string1'")
>>> 
>>> should be:
>>> 
>>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>>> doc2.object(XWiki.XWikiComments) comm2
>>> WHERE doc2.translation = 0 and comm2.comment LIKE ':string1'")
>>> 
>> 
>> Thanks for the note, Vicent! I've already tried that, but I was not able to 
>> solve this error:
>> 
>> Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception 
>> while hibernate execute
>> Wrapped Exception: could not locate named parameter [string1]
>> 
>> I've modified the code at the link below to show you the whole error 
>> message...
>> 
>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
> 
> It's easy, you've used string1 instead of $string1 in bindValue()… :)
> 
> Thanks
> -Vincent
> 
>> I read your reference to bind variables in 
>> http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module, but I'm 
>> not able to find my error!
>> 
>> P

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-31 Thread Ricardo.Julio.Rodriguez.Fernandez
Hi Vicent!

Sorry for top-replying, but this email client is a PITA!

Something else must be failing, this alternatives don't work neither:

#set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
comm2.comment LIKE ':string1'")
#set ($results = 
$services.query.xwql($xwqlquery).bindValue("string1",$string1).execute())

#set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
comm2.comment LIKE ':string1'")
#set ($results = 
$services.query.xwql($xwqlquery).bindValue("string1",'$string1').execute())

#set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
doc2.object(XWiki.XWikiComments) comm2 WHERE doc2.translation = 0 and 
comm2.comment LIKE ':string1'")
#set ($results = 
$services.query.xwql($xwqlquery).bindValue("string1","$string1").execute())

I always get the same error...

Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while 
hibernate execute
Wrapped Exception: could not locate named parameter [string1]

Any idea will be welcome!

Thanks!


From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
Massol [vinc...@massol.net]
Sent: 31 May 2013 08:15
To: XWiki Users
Cc: Lista Garcia, Isabel
Subject: Re: [xwiki-users] XWQL query on several objects of the same class  
instantiated in the same doc

Hi Ricardo,

On May 30, 2013, at 10:54 PM, ricardo.julio.rodriguez.fernan...@sergas.es wrote:

> Hi Vicent!
>
>> 
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
>> Massol [vinc...@massol.net]
>> Sent: 28 May 2013 08:45
>> To: XWiki Users
>> Cc: Lista Garcia, Isabel
>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class   
>>instantiated in the same doc
>>
>> Hi Ricardo,
>>
>> On May 28, 2013, at 7:35 AM,  
>> wrote:
>>
>>> Hi Vincent, all!
>>>
>>> Please, do you think this is of any value and clear enough as to going to 
>>> XWiki Extensions Query Module page?
>>>
>>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
>>
>> Yes it would be great to add this to extensions.xwiki.org :)
>>
>> Since it's not a single query I'm not sure the best place is the query 
>> module page.
>>
>> I'd say that it could be added as an entire snippet on extensions.xwiki.org.
>>
>> Important Note: Your code is written dangerously and is subject to XSS 
>> attacks. You need to modify it and use binding:
>>
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2
>> WHERE doc2.translation = 0 and comm2.comment LIKE '$string1'")
>>
>> should be:
>>
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2
>> WHERE doc2.translation = 0 and comm2.comment LIKE ':string1'")
>>
>
> Thanks for the note, Vicent! I've already tried that, but I was not able to 
> solve this error:
>
> Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while 
> hibernate execute
> Wrapped Exception: could not locate named parameter [string1]
>
> I've modified the code at the link below to show you the whole error 
> message...
>
> http://www.idisantiago.es/bin/XWQL/QueryOnComments

It's easy, you've used string1 instead of $string1 in bindValue()… :)

Thanks
-Vincent

> I read your reference to bind variables in 
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module, but I'm 
> not able to find my error!
>
> Please, where am I wrong? I'm still working with a XE 2.4.30451 installation.
>
> Thanks!
>
>> And then:
>>
>> $services.query.xwql($xwqlquery).bindValue("string1", string1).execute()
>>
>> Thanks
>> -Vincent
>>
>>>
>>> Thanks!
>>>
>>> 
>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>> Vincent Massol [vinc...@massol.net]
>>> Sent: 23 May 2013 08:09
>>> To: XWiki Users
>>> Cc: Lista Garcia, Isabel
>>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
>>> instantiated in the same doc
>>>
>>> Getting closer :)
>>>
>>> Ricardo, when you resolve this, it would be great if you could ad

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-30 Thread Vincent Massol
Hi Ricardo,

On May 30, 2013, at 10:54 PM, ricardo.julio.rodriguez.fernan...@sergas.es wrote:

> Hi Vicent!
> 
>> 
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
>> Massol [vinc...@massol.net]
>> Sent: 28 May 2013 08:45
>> To: XWiki Users
>> Cc: Lista Garcia, Isabel
>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class   
>>instantiated in the same doc
>> 
>> Hi Ricardo,
>> 
>> On May 28, 2013, at 7:35 AM,  
>> wrote:
>> 
>>> Hi Vincent, all!
>>> 
>>> Please, do you think this is of any value and clear enough as to going to 
>>> XWiki Extensions Query Module page?
>>> 
>>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
>> 
>> Yes it would be great to add this to extensions.xwiki.org :)
>> 
>> Since it's not a single query I'm not sure the best place is the query 
>> module page.
>> 
>> I'd say that it could be added as an entire snippet on extensions.xwiki.org.
>> 
>> Important Note: Your code is written dangerously and is subject to XSS 
>> attacks. You need to modify it and use binding:
>> 
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2
>> WHERE doc2.translation = 0 and comm2.comment LIKE '$string1'")
>> 
>> should be:
>> 
>> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
>> doc2.object(XWiki.XWikiComments) comm2
>> WHERE doc2.translation = 0 and comm2.comment LIKE ':string1'")
>> 
> 
> Thanks for the note, Vicent! I've already tried that, but I was not able to 
> solve this error:
> 
> Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while 
> hibernate execute
> Wrapped Exception: could not locate named parameter [string1]
> 
> I've modified the code at the link below to show you the whole error 
> message...
> 
> http://www.idisantiago.es/bin/XWQL/QueryOnComments

It's easy, you've used string1 instead of $string1 in bindValue()… :)

Thanks
-Vincent

> I read your reference to bind variables in 
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module, but I'm 
> not able to find my error!
> 
> Please, where am I wrong? I'm still working with a XE 2.4.30451 installation.
> 
> Thanks!
> 
>> And then:
>> 
>> $services.query.xwql($xwqlquery).bindValue("string1", string1).execute()
>> 
>> Thanks
>> -Vincent
>> 
>>> 
>>> Thanks!
>>> 
>>> 
>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>> Vincent Massol [vinc...@massol.net]
>>> Sent: 23 May 2013 08:09
>>> To: XWiki Users
>>> Cc: Lista Garcia, Isabel
>>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
>>> instantiated in the same doc
>>> 
>>> Getting closer :)
>>> 
>>> Ricardo, when you resolve this, it would be great if you could add an 
>>> example on
>>> http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module so that 
>>> next time someone has the same question he/she can find some example of 
>>> nested query there.
>>> 
>>> Thanks
>>> -Vincent
>>> 
>>> On May 23, 2013, at 1:36 AM, ricardo.julio.rodriguez.fernan...@sergas.es 
>>> wrote:
>>> 
>>>> Hi!
>>>> 
>>>>> 
>>>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>>>> BOUSQUET Jeremie [jeremie.bousq...@gemalto.com]
>>>>> Sent: 22 May 2013 22:38
>>>>> To: XWiki Users
>>>>> Cc: Lista Garcia, Isabel
>>>>> Subject: [xwiki-users] Re : XWQL query on several objects of the same 
>>>>> class instantiated in the same doc
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> You miss the .execute() at the end :)
>>>>> 
>>>> 
>>>> Call me stupid! Thanks, Jeremie! Thanks Louis-Marie and Ebo!
>>>> 
>>>> But I'm afraid I'm still not able to run the script without errors. It 
>>>> seems to me that the XWQL query...
>>>> 
>>>> SELECT doc2.fullName FROM Document doc2, doc2.object(XWiki.XWikiComments) 
>>>> comm2
>>>> WHERE comm2.comment LIKE '%Withdrawal:2011%'
>>>> 
>>>> doesn't generate a suitable list to enter in a NOT In construct. It 
>>>> generates this...
>>>> 
>>>> [XWiki.MariaCerezo, XWiki.RodrigoCabanasGancedo, 
>>>> XWiki.JeronimoFortezaVila, ...]
>>>> 
>>>> 
>>>> 'XWiki.MariaCerezo', 'XWiki.RodrigoCabanasGancedo', 
>>>> 'XWiki.JeronimoFortezaVila', ...
>>>> 
>>>> At the bottom of the page...
>>>> 
>>>> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>>>> 
>>>> ... you'll find the error and the script split into several code chunks 
>>>> working perfectly.
>>>> 
>>>> Please, am I right with the source of the problem? How could I change to 
>>>> the 'item','item2',ìtem3'...
>>>> 
>>>> How could I change the way XWQL gives layout to the list?
>>>> 
>>>> Thank you very much!!
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-30 Thread Ricardo.Julio.Rodriguez.Fernandez
Hi Paul! Thanks for your comment. Performance is already an issue in our "not 
so big" wiki! Thus, we have to keep an eye on any alternative than can offer us 
a better response even with simple queries. But, even although we are still 
working with an old XE release, it is still possible to use it to better 
understand the XWiki Data Model and be ready to leverage its power when we can 
upgrade to a newer installation.

Greetings!

Ricardo


From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Paul 
Libbrecht [p...@hoplahup.net]
Sent: 28 May 2013 08:48
To: XWiki Users
Cc: Lista Garcia, Isabel
Subject: Re: [xwiki-users] XWQL query on several objects of the same class  
instantiated in the same doc

Wow, such a query is likely to be slow on a big wiki... I'd sift a word on that 
(as it uses the "like" operator of the DB).
Using the lucene or solr search modules is likely to give a considerable amount 
of performance gain.

paul


On 28 mai 2013, at 08:45, Vincent Massol wrote:

> Hi Ricardo,
>
> On May 28, 2013, at 7:35 AM,  
> wrote:
>
>> Hi Vincent, all!
>>
>> Please, do you think this is of any value and clear enough as to going to 
>> XWiki Extensions Query Module page?
>>
>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
>
> Yes it would be great to add this to extensions.xwiki.org :)
>
> Since it's not a single query I'm not sure the best place is the query module 
> page.
>
> I'd say that it could be added as an entire snippet on extensions.xwiki.org.
>
> Important Note: Your code is written dangerously and is subject to XSS 
> attacks. You need to modify it and use binding:
>
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2
> WHERE doc2.translation = 0 and comm2.comment LIKE '$string1'")
>
> should be:
>
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2
> WHERE doc2.translation = 0 and comm2.comment LIKE ':string1'")
>
> And then:
>
> $services.query.xwql($xwqlquery).bindValue("string1", string1).execute()
>
> Thanks
> -Vincent
>
>>
>> Thanks!
>>
>> ____________________
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
>> Massol [vinc...@massol.net]
>> Sent: 23 May 2013 08:09
>> To: XWiki Users
>> Cc: Lista Garcia, Isabel
>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
>> instantiated in the same doc
>>
>> Getting closer :)
>>
>> Ricardo, when you resolve this, it would be great if you could add an 
>> example on http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module 
>> so that next time someone has the same question he/she can find some example 
>> of nested query there.
>>
>> Thanks
>> -Vincent
>>
>> On May 23, 2013, at 1:36 AM, ricardo.julio.rodriguez.fernan...@sergas.es 
>> wrote:
>>
>>> Hi!
>>>
>>>> 
>>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>>> BOUSQUET Jeremie [jeremie.bousq...@gemalto.com]
>>>> Sent: 22 May 2013 22:38
>>>> To: XWiki Users
>>>> Cc: Lista Garcia, Isabel
>>>> Subject: [xwiki-users] Re : XWQL query on several objects of the same 
>>>> class instantiated in the same doc
>>>>
>>>> Hi,
>>>>
>>>> You miss the .execute() at the end :)
>>>>
>>>
>>> Call me stupid! Thanks, Jeremie! Thanks Louis-Marie and Ebo!
>>>
>>> But I'm afraid I'm still not able to run the script without errors. It 
>>> seems to me that the XWQL query...
>>>
>>> SELECT doc2.fullName FROM Document doc2, doc2.object(XWiki.XWikiComments) 
>>> comm2
>>> WHERE comm2.comment LIKE '%Withdrawal:2011%'
>>>
>>> doesn't generate a suitable list to enter in a NOT In construct. It 
>>> generates this...
>>>
>>> [XWiki.MariaCerezo, XWiki.RodrigoCabanasGancedo, XWiki.JeronimoFortezaVila, 
>>> ...]
>>>
>>> And it seems that NOT IN needs something like this...
>>>
>>> 'XWiki.MariaCerezo', 'XWiki.RodrigoCabanasGancedo', 
>>> 'XWiki.JeronimoFortezaVila', ...
>>>
>>> At the bottom of the page...
>>>
>>> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>>>
>>> ... you&#

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-30 Thread Ricardo.Julio.Rodriguez.Fernandez
Hi Vicent!

> 
> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
> Massol [vinc...@massol.net]
> Sent: 28 May 2013 08:45
> To: XWiki Users
> Cc: Lista Garcia, Isabel
> Subject: Re: [xwiki-users] XWQL query on several objects of the same class    
>   instantiated in the same doc
>
> Hi Ricardo,
>
> On May 28, 2013, at 7:35 AM,  
> wrote:
>
>> Hi Vincent, all!
>>
>> Please, do you think this is of any value and clear enough as to going to 
>> XWiki Extensions Query Module page?
>>
>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
>
> Yes it would be great to add this to extensions.xwiki.org :)
>
> Since it's not a single query I'm not sure the best place is the query module 
> page.
>
> I'd say that it could be added as an entire snippet on extensions.xwiki.org.
>
> Important Note: Your code is written dangerously and is subject to XSS 
> attacks. You need to modify it and use binding:
>
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2
> WHERE doc2.translation = 0 and comm2.comment LIKE '$string1'")
>
> should be:
>
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2
> WHERE doc2.translation = 0 and comm2.comment LIKE ':string1'")
>

Thanks for the note, Vicent! I've already tried that, but I was not able to 
solve this error:

Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while 
hibernate execute
Wrapped Exception: could not locate named parameter [string1]

I've modified the code at the link below to show you the whole error message...

http://www.idisantiago.es/bin/XWQL/QueryOnComments

I read your reference to bind variables in 
http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module, but I'm not 
able to find my error!

Please, where am I wrong? I'm still working with a XE 2.4.30451 installation.

Thanks!

> And then:
>
> $services.query.xwql($xwqlquery).bindValue("string1", string1).execute()
>
> Thanks
> -Vincent
>
>>
>> Thanks!
>>
>> ____________________
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
>> Massol [vinc...@massol.net]
>> Sent: 23 May 2013 08:09
>> To: XWiki Users
>> Cc: Lista Garcia, Isabel
>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
>> instantiated in the same doc
>>
>> Getting closer :)
>>
>> Ricardo, when you resolve this, it would be great if you could add an 
>> example on
>> http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module so that 
>> next time someone has the same question he/she can find some example of 
>> nested query there.
>>
>> Thanks
>> -Vincent
>>
>> On May 23, 2013, at 1:36 AM, ricardo.julio.rodriguez.fernan...@sergas.es 
>> wrote:
>>
>>> Hi!
>>>
>>>> 
>>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>>> BOUSQUET Jeremie [jeremie.bousq...@gemalto.com]
>>>> Sent: 22 May 2013 22:38
>>>> To: XWiki Users
>>>> Cc: Lista Garcia, Isabel
>>>> Subject: [xwiki-users] Re : XWQL query on several objects of the same 
>>>> class instantiated in the same doc
>>>>
>>>> Hi,
>>>>
>>>> You miss the .execute() at the end :)
>>>>
>>>
>>> Call me stupid! Thanks, Jeremie! Thanks Louis-Marie and Ebo!
>>>
>>> But I'm afraid I'm still not able to run the script without errors. It 
>>> seems to me that the XWQL query...
>>>
>>> SELECT doc2.fullName FROM Document doc2, doc2.object(XWiki.XWikiComments) 
>>> comm2
>>> WHERE comm2.comment LIKE '%Withdrawal:2011%'
>>>
>>> doesn't generate a suitable list to enter in a NOT In construct. It 
>>> generates this...
>>>
>>> [XWiki.MariaCerezo, XWiki.RodrigoCabanasGancedo, XWiki.JeronimoFortezaVila, 
>>> ...]
>>>
>>>
>>> 'XWiki.MariaCerezo', 'XWiki.RodrigoCabanasGancedo', 
>>> 'XWiki.JeronimoFortezaVila', ...
>>>
>>> At the bottom of the page...
>>>
>>> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>>>
>>> ... you'll find the error and the script split into several code chunks 
>>> working perfectly.
>>&

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-27 Thread Paul Libbrecht
Wow, such a query is likely to be slow on a big wiki... I'd sift a word on that 
(as it uses the "like" operator of the DB).
Using the lucene or solr search modules is likely to give a considerable amount 
of performance gain.

paul


On 28 mai 2013, at 08:45, Vincent Massol wrote:

> Hi Ricardo,
> 
> On May 28, 2013, at 7:35 AM,  
> wrote:
> 
>> Hi Vincent, all!
>> 
>> Please, do you think this is of any value and clear enough as to going to 
>> XWiki Extensions Query Module page?
>> 
>> http://www.idisantiago.es/bin/XWQL/QueryOnComments
> 
> Yes it would be great to add this to extensions.xwiki.org :)
> 
> Since it's not a single query I'm not sure the best place is the query module 
> page.
> 
> I'd say that it could be added as an entire snippet on extensions.xwiki.org.
> 
> Important Note: Your code is written dangerously and is subject to XSS 
> attacks. You need to modify it and use binding:
> 
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2
> WHERE doc2.translation = 0 and comm2.comment LIKE '$string1'")
> 
> should be:
> 
> #set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
> doc2.object(XWiki.XWikiComments) comm2
> WHERE doc2.translation = 0 and comm2.comment LIKE ':string1'")
> 
> And then:
> 
> $services.query.xwql($xwqlquery).bindValue("string1", string1).execute()
> 
> Thanks
> -Vincent
> 
>> 
>> Thanks!
>> 
>> ________________
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
>> Massol [vinc...@massol.net]
>> Sent: 23 May 2013 08:09
>> To: XWiki Users
>> Cc: Lista Garcia, Isabel
>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
>> instantiated in the same doc
>> 
>> Getting closer :)
>> 
>> Ricardo, when you resolve this, it would be great if you could add an 
>> example on http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module 
>> so that next time someone has the same question he/she can find some example 
>> of nested query there.
>> 
>> Thanks
>> -Vincent
>> 
>> On May 23, 2013, at 1:36 AM, ricardo.julio.rodriguez.fernan...@sergas.es 
>> wrote:
>> 
>>> Hi!
>>> 
>>>> 
>>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>>> BOUSQUET Jeremie [jeremie.bousq...@gemalto.com]
>>>> Sent: 22 May 2013 22:38
>>>> To: XWiki Users
>>>> Cc: Lista Garcia, Isabel
>>>> Subject: [xwiki-users] Re : XWQL query on several objects of the same 
>>>> class instantiated in the same doc
>>>> 
>>>> Hi,
>>>> 
>>>> You miss the .execute() at the end :)
>>>> 
>>> 
>>> Call me stupid! Thanks, Jeremie! Thanks Louis-Marie and Ebo!
>>> 
>>> But I'm afraid I'm still not able to run the script without errors. It 
>>> seems to me that the XWQL query...
>>> 
>>> SELECT doc2.fullName FROM Document doc2, doc2.object(XWiki.XWikiComments) 
>>> comm2
>>> WHERE comm2.comment LIKE '%Withdrawal:2011%'
>>> 
>>> doesn't generate a suitable list to enter in a NOT In construct. It 
>>> generates this...
>>> 
>>> [XWiki.MariaCerezo, XWiki.RodrigoCabanasGancedo, XWiki.JeronimoFortezaVila, 
>>> ...]
>>> 
>>> And it seems that NOT IN needs something like this...
>>> 
>>> 'XWiki.MariaCerezo', 'XWiki.RodrigoCabanasGancedo', 
>>> 'XWiki.JeronimoFortezaVila', ...
>>> 
>>> At the bottom of the page...
>>> 
>>> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>>> 
>>> ... you'll find the error and the script split into several code chunks 
>>> working perfectly.
>>> 
>>> Please, am I right with the source of the problem? How could I change to 
>>> the 'item','item2',ìtem3'...
>>> 
>>> How could I change the way XWQL gives layout to the list?
>>> 
>>> Thank you very much!!
>>> 
>>> 
>>>> 
>>>> Br,
>>>> Jeremie
>>>> 
>>>> Envoyé depuis mon HTC
>>>> 
>>>> 
>>>> - Reply message -
>>>> De : "ricardo.julio.rodriguez.fernan...@sergas.es" 
>>>> 
>>>&

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-27 Thread Vincent Massol
Hi Ricardo,

On May 28, 2013, at 7:35 AM,  
wrote:

> Hi Vincent, all!
> 
> Please, do you think this is of any value and clear enough as to going to 
> XWiki Extensions Query Module page?
> 
> http://www.idisantiago.es/bin/XWQL/QueryOnComments

Yes it would be great to add this to extensions.xwiki.org :)

Since it's not a single query I'm not sure the best place is the query module 
page.

I'd say that it could be added as an entire snippet on extensions.xwiki.org.

Important Note: Your code is written dangerously and is subject to XSS attacks. 
You need to modify it and use binding:

#set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
doc2.object(XWiki.XWikiComments) comm2
WHERE doc2.translation = 0 and comm2.comment LIKE '$string1'")

should be:

#set ($xwqlquery = "SELECT doc2.fullName FROM Document doc2, 
doc2.object(XWiki.XWikiComments) comm2
WHERE doc2.translation = 0 and comm2.comment LIKE ':string1'")

And then:

$services.query.xwql($xwqlquery).bindValue("string1", string1).execute()

Thanks
-Vincent

> 
> Thanks!
> 
> 
> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
> Massol [vinc...@massol.net]
> Sent: 23 May 2013 08:09
> To: XWiki Users
> Cc: Lista Garcia, Isabel
> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
> instantiated in the same doc
> 
> Getting closer :)
> 
> Ricardo, when you resolve this, it would be great if you could add an example 
> on http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module so that 
> next time someone has the same question he/she can find some example of 
> nested query there.
> 
> Thanks
> -Vincent
> 
> On May 23, 2013, at 1:36 AM, ricardo.julio.rodriguez.fernan...@sergas.es 
> wrote:
> 
>> Hi!
>> 
>>> 
>>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>>> BOUSQUET Jeremie [jeremie.bousq...@gemalto.com]
>>> Sent: 22 May 2013 22:38
>>> To: XWiki Users
>>> Cc: Lista Garcia, Isabel
>>> Subject: [xwiki-users] Re : XWQL query on several objects of the same class 
>>> instantiated in the same doc
>>> 
>>> Hi,
>>> 
>>> You miss the .execute() at the end :)
>>> 
>> 
>> Call me stupid! Thanks, Jeremie! Thanks Louis-Marie and Ebo!
>> 
>> But I'm afraid I'm still not able to run the script without errors. It seems 
>> to me that the XWQL query...
>> 
>> SELECT doc2.fullName FROM Document doc2, doc2.object(XWiki.XWikiComments) 
>> comm2
>> WHERE comm2.comment LIKE '%Withdrawal:2011%'
>> 
>> doesn't generate a suitable list to enter in a NOT In construct. It 
>> generates this...
>> 
>> [XWiki.MariaCerezo, XWiki.RodrigoCabanasGancedo, XWiki.JeronimoFortezaVila, 
>> ...]
>> 
>> And it seems that NOT IN needs something like this...
>> 
>> 'XWiki.MariaCerezo', 'XWiki.RodrigoCabanasGancedo', 
>> 'XWiki.JeronimoFortezaVila', ...
>> 
>> At the bottom of the page...
>> 
>> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>> 
>> ... you'll find the error and the script split into several code chunks 
>> working perfectly.
>> 
>> Please, am I right with the source of the problem? How could I change to the 
>> 'item','item2',ìtem3'...
>> 
>> How could I change the way XWQL gives layout to the list?
>> 
>> Thank you very much!!
>> 
>> 
>>> 
>>> Br,
>>> Jeremie
>>> 
>>> Envoyé depuis mon HTC
>>> 
>>> 
>>> - Reply message -
>>> De : "ricardo.julio.rodriguez.fernan...@sergas.es" 
>>> 
>>> Pour : "users@xwiki.org" 
>>> Cc : "isabel.lista.gar...@sergas.es" 
>>> Objet : [xwiki-users] XWQL query on several objects of the same class 
>>> instantiated in the same doc
>>> Date : mer., mai 22, 2013 21:24
>>> 
>>> 
>>> 
>>> Louis-Marie, Edo, thanks again!
>>> 
>>> Louis-Marie, you perfectly understand what I'm trying to get: to use 
>>> comments on documents as criteria for selection.
>>> I understand comments are not intended to satisfy this objetive, but, at 
>>> least for me, they are extremely useful to "draft"
>>> data models to be implemented in new XWiki classes. Just a kind of "extreme 
>>> development" tool! :-)
>>>

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-27 Thread Ricardo.Julio.Rodriguez.Fernandez
Hi Vincent, all!

Please, do you think this is of any value and clear enough as to going to XWiki 
Extensions Query Module page?

http://www.idisantiago.es/bin/XWQL/QueryOnComments

Thanks!


From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of Vincent 
Massol [vinc...@massol.net]
Sent: 23 May 2013 08:09
To: XWiki Users
Cc: Lista Garcia, Isabel
Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
instantiated in the same doc

Getting closer :)

Ricardo, when you resolve this, it would be great if you could add an example 
on http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module so that 
next time someone has the same question he/she can find some example of nested 
query there.

Thanks
-Vincent

On May 23, 2013, at 1:36 AM, ricardo.julio.rodriguez.fernan...@sergas.es wrote:

> Hi!
>
>> 
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>> BOUSQUET Jeremie [jeremie.bousq...@gemalto.com]
>> Sent: 22 May 2013 22:38
>> To: XWiki Users
>> Cc: Lista Garcia, Isabel
>> Subject: [xwiki-users] Re : XWQL query on several objects of the same class 
>> instantiated in the same doc
>>
>> Hi,
>>
>> You miss the .execute() at the end :)
>>
>
> Call me stupid! Thanks, Jeremie! Thanks Louis-Marie and Ebo!
>
> But I'm afraid I'm still not able to run the script without errors. It seems 
> to me that the XWQL query...
>
> SELECT doc2.fullName FROM Document doc2, doc2.object(XWiki.XWikiComments) 
> comm2
> WHERE comm2.comment LIKE '%Withdrawal:2011%'
>
> doesn't generate a suitable list to enter in a NOT In construct. It generates 
> this...
>
> [XWiki.MariaCerezo, XWiki.RodrigoCabanasGancedo, XWiki.JeronimoFortezaVila, 
> ...]
>
> And it seems that NOT IN needs something like this...
>
> 'XWiki.MariaCerezo', 'XWiki.RodrigoCabanasGancedo', 
> 'XWiki.JeronimoFortezaVila', ...
>
> At the bottom of the page...
>
> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>
> ... you'll find the error and the script split into several code chunks 
> working perfectly.
>
> Please, am I right with the source of the problem? How could I change to the 
> 'item','item2',ìtem3'...
>
> How could I change the way XWQL gives layout to the list?
>
> Thank you very much!!
>
>
>>
>> Br,
>> Jeremie
>>
>> Envoyé depuis mon HTC
>>
>>
>> - Reply message -
>> De : "ricardo.julio.rodriguez.fernan...@sergas.es" 
>> 
>> Pour : "users@xwiki.org" 
>> Cc : "isabel.lista.gar...@sergas.es" 
>> Objet : [xwiki-users] XWQL query on several objects of the same class 
>> instantiated in the same doc
>> Date : mer., mai 22, 2013 21:24
>>
>>
>>
>> Louis-Marie, Edo, thanks again!
>>
>> Louis-Marie, you perfectly understand what I'm trying to get: to use 
>> comments on documents as criteria for selection.
>> I understand comments are not intended to satisfy this objetive, but, at 
>> least for me, they are extremely useful to "draft"
>> data models to be implemented in new XWiki classes. Just a kind of "extreme 
>> development" tool! :-)
>> I think the "only" problem we are facing with this use is the kind of 
>> queries combining comments on the
>> same document to retrive documents and properties of any class there 
>> instantiated.
>>
>> I'm truly learning a lot! I think I can understand the construction and it 
>> must answer the well-formed question
>> Louis-Marie wrote down in his message, but I'm not able to understand the 
>> result. Here what I get...
>>
>> org.xwiki.query.internal.DefaultQuery@70687068
>>
>> The integer after the @ changes it time I reload the page. I din't get 
>> neither a document fullName, nor an object.
>>
>> You can always check it in the same link posted before...
>>
>> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>>
>> In found DefaultQuery code here...
>
> http://maven.xwiki.org/site/clover/20120701/clover-platform-20120702/org/xwiki/query/internal/DefaultQuery.html
>
> Perhaps this construct doesn't work in my plain old XWIKI ENTERPRISE 
> 2.4.30451 installation?
>
> Thanks for your help!
>
> Ricardo
>
>
>> 
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>> Guillaume "Louis-Marie" Delhumeau [gdelhum...@xwiki

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-22 Thread Vincent Massol
Getting closer :)

Ricardo, when you resolve this, it would be great if you could add an example 
on http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module so that 
next time someone has the same question he/she can find some example of nested 
query there.

Thanks
-Vincent

On May 23, 2013, at 1:36 AM, ricardo.julio.rodriguez.fernan...@sergas.es wrote:

> Hi!
> 
>> 
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>> BOUSQUET Jeremie [jeremie.bousq...@gemalto.com]
>> Sent: 22 May 2013 22:38
>> To: XWiki Users
>> Cc: Lista Garcia, Isabel
>> Subject: [xwiki-users] Re : XWQL query on several objects of the same class 
>> instantiated in the same doc
>> 
>> Hi,
>> 
>> You miss the .execute() at the end :)
>> 
> 
> Call me stupid! Thanks, Jeremie! Thanks Louis-Marie and Ebo!
> 
> But I'm afraid I'm still not able to run the script without errors. It seems 
> to me that the XWQL query...
> 
> SELECT doc2.fullName FROM Document doc2, doc2.object(XWiki.XWikiComments) 
> comm2
> WHERE comm2.comment LIKE '%Withdrawal:2011%'
> 
> doesn't generate a suitable list to enter in a NOT In construct. It generates 
> this...
> 
> [XWiki.MariaCerezo, XWiki.RodrigoCabanasGancedo, XWiki.JeronimoFortezaVila, 
> ...]
> 
> And it seems that NOT IN needs something like this...
> 
> 'XWiki.MariaCerezo', 'XWiki.RodrigoCabanasGancedo', 
> 'XWiki.JeronimoFortezaVila', ...
> 
> At the bottom of the page...
> 
> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
> 
> ... you'll find the error and the script split into several code chunks 
> working perfectly.
> 
> Please, am I right with the source of the problem? How could I change to the 
> 'item','item2',ìtem3'...
> 
> How could I change the way XWQL gives layout to the list?
> 
> Thank you very much!!
> 
> 
>> 
>> Br,
>> Jeremie
>> 
>> Envoyé depuis mon HTC
>> 
>> 
>> - Reply message -
>> De : "ricardo.julio.rodriguez.fernan...@sergas.es" 
>> 
>> Pour : "users@xwiki.org" 
>> Cc : "isabel.lista.gar...@sergas.es" 
>> Objet : [xwiki-users] XWQL query on several objects of the same class 
>> instantiated in the same doc
>> Date : mer., mai 22, 2013 21:24
>> 
>> 
>> 
>> Louis-Marie, Edo, thanks again!
>> 
>> Louis-Marie, you perfectly understand what I'm trying to get: to use 
>> comments on documents as criteria for selection.
>> I understand comments are not intended to satisfy this objetive, but, at 
>> least for me, they are extremely useful to "draft"
>> data models to be implemented in new XWiki classes. Just a kind of "extreme 
>> development" tool! :-)
>> I think the "only" problem we are facing with this use is the kind of 
>> queries combining comments on the
>> same document to retrive documents and properties of any class there 
>> instantiated.
>> 
>> I'm truly learning a lot! I think I can understand the construction and it 
>> must answer the well-formed question
>> Louis-Marie wrote down in his message, but I'm not able to understand the 
>> result. Here what I get...
>> 
>> org.xwiki.query.internal.DefaultQuery@70687068
>> 
>> The integer after the @ changes it time I reload the page. I din't get 
>> neither a document fullName, nor an object.
>> 
>> You can always check it in the same link posted before...
>> 
>> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>> 
>> In found DefaultQuery code here...
> 
> http://maven.xwiki.org/site/clover/20120701/clover-platform-20120702/org/xwiki/query/internal/DefaultQuery.html
> 
> Perhaps this construct doesn't work in my plain old XWIKI ENTERPRISE 
> 2.4.30451 installation?
> 
> Thanks for your help!
> 
> Ricardo
> 
> 
>> 
>> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
>> Guillaume "Louis-Marie" Delhumeau [gdelhum...@xwiki.com]
>> Sent: 22 May 2013 17:51
>> To: XWiki Users
>> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
>> instantiated in the same doc
>> 
>> Hi.
>> 
>> I'm not sure I really understood what you need to do, but let me propose a
>> solution anyway.
>> 
>> I think what you need is to get the all the documents that contains
>> comments with "%doc.title%" 

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-22 Thread Ricardo.Julio.Rodriguez.Fernandez
Louis-Marie, Edo, thanks again!

Louis-Marie, you perfectly understand what I'm trying to get: to use comments 
on documents as criteria for selection. I understand comments are not intended 
to satisfy this objetive, but, at least for me, they are extremely useful to 
"draft" data models to be implemented in new XWiki classes. Just a kind of 
"extreme development" tool! :-) I think the "only" problem we are facing with 
this use is the kind of queries combining comments on the same document to 
retrive documents and properties of any class there instantiated.

I'm truly learning a lot! I think I can understand the construction and it must 
answer the well-formed question Louis-Marie wrote down in his message, but I'm 
not able to understand the result. Here what I get...

org.xwiki.query.internal.DefaultQuery@70687068

The integer after the @ changes it time I reload the page. I din't get neither 
a document fullName, nor an object.

You can always check it in the same link posted before...

http://www.idisantiago.es/bin/XWQL/SnapshotE0012012

In found DefaultQuery code here...

http://maven.xwiki.org/site/clover/20120701/clover-platform-20120702/org/xwiki/query/internal/DefaultQuery.html

Perhaps this construct doesn't work in my plain old XWIKI ENTERPRISE 2.4.30451 
installation?

Thanks for your help!

Ricardo


> 
> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
> Guillaume "Louis-Marie" Delhumeau [gdelhum...@xwiki.com]
> Sent: 22 May 2013 17:51
> To: XWiki Users
> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
> instantiated in the same doc
>
> Hi.
>
> I'm not sure I really understood what you need to do, but let me propose a
> solution anyway.
>
> I think what you need is to get the all the documents that contains
> comments with "%doc.title%" content and where there is NO comment with
> '%Withdrawal:2011% in the content.
>
> So, that's how I would solve the problem:
>
> #set ($xwlquery1 = "FROM doc.object(XWiki.
> XWikiComments) AS commWHERE  doc.translation = 0 AND  and comm.comment LIKE
> :doctitle AND doc.fullName NOT IN (SELECT doc2.fullName FROM Document doc2,
> doc2.object(XWiki.XWikiComments) comm2 WHERE comm2.comment LIKE
> '%Withdrawal:2011%')")
> #set($results = $services.query.xwql($xwqlquery1).bindValue('doctitle',
> "%${doc.title}%"))
>
> I didn't test it but it should work.
>
> Louis-Marie.
>
> 2013/5/22 
>
>> Hi! Thanks you both for answering!
>>
>> I'm afraid that your proposals didn't solve the problem. Please, see
>> here...
>>
>> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>>
>> Both users have three comments each. This way:
>>
>> XWD_ID:416379378
>> Gender:
>> Withdrawal:20121017
>> Formely:XWiki.XWikiIDISE001
>>
>> XWD_ID:946660794
>> Gender:
>> Withdrawal:20111231
>> Formely:XWiki.XWikiIDISE001
>>
>> Thus, I'm still not able to design a query to retrive ONLY user
>> XWD_ID:416379378 based on comments :-( Your proposals answer with a list
>> including both users n times. I'm not able neither of explain n in both
>> cases... any idea will be welcome!
>>
>> Thank you very much for your help,
>>
>> Ricardo
>>
>>
>> > 
>> > From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of
>> Guillaume "Louis-Marie" Delhumeau [gdelhum...@xwiki.com]
>> > Sent: 22 May 2013 13:02
>> > To: XWiki Users
>> > Subject: Re: [xwiki-users] XWQL query on several objects of the same
>> class instantiated in the same doc
>> >
>> > Hi Ricardo and Edo,
>> >
>> > 2013/5/22 Edo Beutler 
>> >
>> >> Hi Ricardo
>> >>
>> >> You are only checking in one object. So there has to be one object that
>> >> contains the doc name, but not the withdrawal part which is fulfilled by
>> >> the third object in your example. Whilst I don't recall ever having
>> tried
>> >> checking for multiple objects in XWQL, I would suspect this should work:
>> >>
>> >> #set ($xwlquery1 = "from doc.object(XWiki.XWikiComments) as comm1,
>> >> doc.object(XWiki.XWikiComments) as comm2 where doc.translation = 0 and
>> >> comm1.comment like '%$doc.title%' and comm2.comment not like
>> >> '%Withdrawal:2011%'")
>> >>
>> >
>> > You are right. But 

Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-22 Thread Edo Beutler
Ah ... exactly, NOT IN was what I was trying remember. So forget my count
construct :)



On Wed, May 22, 2013 at 5:51 PM, Guillaume "Louis-Marie" Delhumeau <
gdelhum...@xwiki.com> wrote:

> Hi.
>
> I'm not sure I really understood what you need to do, but let me propose a
> solution anyway.
>
> I think what you need is to get the all the documents that contains
> comments with "%doc.title%" content and where there is NO comment with
> '%Withdrawal:2011% in the content.
>
> So, that's how I would solve the problem:
>
> #set ($xwlquery1 = "FROM doc.object(XWiki.
> XWikiComments) AS commWHERE  doc.translation = 0 AND  and comm.comment LIKE
> :doctitle AND doc.fullName NOT IN (SELECT doc2.fullName FROM Document doc2,
> doc2.object(XWiki.XWikiComments) comm2 WHERE comm2.comment LIKE
> '%Withdrawal:2011%')")
> #set($results = $services.query.xwql($xwqlquery1).bindValue('doctitle',
> "%${doc.title}%"))
>
> I didn't test it but it should work.
>
> Louis-Marie.
>
> 2013/5/22 
>
> > Hi! Thanks you both for answering!
> >
> > I'm afraid that your proposals didn't solve the problem. Please, see
> > here...
> >
> > http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
> >
> > Both users have three comments each. This way:
> >
> > XWD_ID:416379378
> > Gender:
> > Withdrawal:20121017
> > Formely:XWiki.XWikiIDISE001
> >
> > XWD_ID:946660794
> > Gender:
> > Withdrawal:20111231
> > Formely:XWiki.XWikiIDISE001
> >
> > Thus, I'm still not able to design a query to retrive ONLY user
> > XWD_ID:416379378 based on comments :-( Your proposals answer with a list
> > including both users n times. I'm not able neither of explain n in both
> > cases... any idea will be welcome!
> >
> > Thank you very much for your help,
> >
> > Ricardo
> >
> >
> > > 
> > > From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of
> > Guillaume "Louis-Marie" Delhumeau [gdelhum...@xwiki.com]
> > > Sent: 22 May 2013 13:02
> > > To: XWiki Users
> > > Subject: Re: [xwiki-users] XWQL query on several objects of the same
> > class instantiated in the same doc
> > >
> > > Hi Ricardo and Edo,
> > >
> > > 2013/5/22 Edo Beutler 
> > >
> > >> Hi Ricardo
> > >>
> > >> You are only checking in one object. So there has to be one object
> that
> > >> contains the doc name, but not the withdrawal part which is fulfilled
> by
> > >> the third object in your example. Whilst I don't recall ever having
> > tried
> > >> checking for multiple objects in XWQL, I would suspect this should
> work:
> > >>
> > >> #set ($xwlquery1 = "from doc.object(XWiki.XWikiComments) as comm1,
> > >> doc.object(XWiki.XWikiComments) as comm2 where doc.translation = 0 and
> > >> comm1.comment like '%$doc.title%' and comm2.comment not like
> > >> '%Withdrawal:2011%'")
> > >>
> > >
> > > You are right. But I think you should add "comm1 <> comm2" in your
> query
> > to
> > > make it work.
> > >
> > > Louis-Marie
> > > ___
> > > users mailing list
> > > users@xwiki.org
> > > http://lists.xwiki.org/mailman/listinfo/users
> >
> > Nota: A información contida nesta mensaxe e os seus posibles documentos
> > adxuntos é privada e confidencial e está dirixida únicamente ó seu
> > destinatario/a. Se vostede non é o/a destinatario/a orixinal desta
> mensaxe,
> > por favor elimínea. A distribución ou copia desta mensaxe non está
> > autorizada.
> >
> > Nota: La información contenida en este mensaje y sus posibles documentos
> > adjuntos es privada y confidencial y está dirigida únicamente a su
> > destinatario/a. Si usted no es el/la destinatario/a original de este
> > mensaje, por favor elimínelo. La distribución o copia de este mensaje no
> > está autorizada.
> >
> > See more languages: http://www.sergas.es/aviso_confidencialidad.htm
> > ___
> > users mailing list
> > users@xwiki.org
> > http://lists.xwiki.org/mailman/listinfo/users
> >
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-22 Thread Guillaume "Louis-Marie" Delhumeau
Hi.

I'm not sure I really understood what you need to do, but let me propose a
solution anyway.

I think what you need is to get the all the documents that contains
comments with "%doc.title%" content and where there is NO comment with
'%Withdrawal:2011% in the content.

So, that's how I would solve the problem:

#set ($xwlquery1 = "FROM doc.object(XWiki.
XWikiComments) AS commWHERE  doc.translation = 0 AND  and comm.comment LIKE
:doctitle AND doc.fullName NOT IN (SELECT doc2.fullName FROM Document doc2,
doc2.object(XWiki.XWikiComments) comm2 WHERE comm2.comment LIKE
'%Withdrawal:2011%')")
#set($results = $services.query.xwql($xwqlquery1).bindValue('doctitle',
"%${doc.title}%"))

I didn't test it but it should work.

Louis-Marie.

2013/5/22 

> Hi! Thanks you both for answering!
>
> I'm afraid that your proposals didn't solve the problem. Please, see
> here...
>
> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>
> Both users have three comments each. This way:
>
> XWD_ID:416379378
> Gender:
> Withdrawal:20121017
> Formely:XWiki.XWikiIDISE001
>
> XWD_ID:946660794
> Gender:
> Withdrawal:20111231
> Formely:XWiki.XWikiIDISE001
>
> Thus, I'm still not able to design a query to retrive ONLY user
> XWD_ID:416379378 based on comments :-( Your proposals answer with a list
> including both users n times. I'm not able neither of explain n in both
> cases... any idea will be welcome!
>
> Thank you very much for your help,
>
> Ricardo
>
>
> > 
> > From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of
> Guillaume "Louis-Marie" Delhumeau [gdelhum...@xwiki.com]
> > Sent: 22 May 2013 13:02
> > To: XWiki Users
> > Subject: Re: [xwiki-users] XWQL query on several objects of the same
> class instantiated in the same doc
> >
> > Hi Ricardo and Edo,
> >
> > 2013/5/22 Edo Beutler 
> >
> >> Hi Ricardo
> >>
> >> You are only checking in one object. So there has to be one object that
> >> contains the doc name, but not the withdrawal part which is fulfilled by
> >> the third object in your example. Whilst I don't recall ever having
> tried
> >> checking for multiple objects in XWQL, I would suspect this should work:
> >>
> >> #set ($xwlquery1 = "from doc.object(XWiki.XWikiComments) as comm1,
> >> doc.object(XWiki.XWikiComments) as comm2 where doc.translation = 0 and
> >> comm1.comment like '%$doc.title%' and comm2.comment not like
> >> '%Withdrawal:2011%'")
> >>
> >
> > You are right. But I think you should add "comm1 <> comm2" in your query
> to
> > make it work.
> >
> > Louis-Marie
> > ___
> > users mailing list
> > users@xwiki.org
> > http://lists.xwiki.org/mailman/listinfo/users
>
> Nota: A información contida nesta mensaxe e os seus posibles documentos
> adxuntos é privada e confidencial e está dirixida únicamente ó seu
> destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe,
> por favor elimínea. A distribución ou copia desta mensaxe non está
> autorizada.
>
> Nota: La información contenida en este mensaje y sus posibles documentos
> adjuntos es privada y confidencial y está dirigida únicamente a su
> destinatario/a. Si usted no es el/la destinatario/a original de este
> mensaje, por favor elimínelo. La distribución o copia de este mensaje no
> está autorizada.
>
> See more languages: http://www.sergas.es/aviso_confidencialidad.htm
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-22 Thread Edo Beutler
Hi Ricardo

I just realised that the problem is, that there are more than two comments.
So the query will find two comments that satisfies your ristrictions, even
though there are more objects which do not.
So e.g. comm1 and comm2 are both objects of the type

XWD_ID:416379378
Gender:
Withdrawal:20121017
Formely:XWiki.XWikiIDISE001

The solution is to write a query like this (unfortunately I can't tell you
the exact XWQL syntax, I'm not even sure if this is possible in XWQL. So
this is just pseudo code):
 and comm1.comment like '%$doc.title%' and 0=(select count(*) .
where comm2.comment not like '%Withdrawal:2011%')

I hope this is possible and you (or somebody else) knows or finds the exact
syntax

Edo


On Wed, May 22, 2013 at 5:26 PM, <
ricardo.julio.rodriguez.fernan...@sergas.es> wrote:

> Hi! Thanks you both for answering!
>
> I'm afraid that your proposals didn't solve the problem. Please, see
> here...
>
> http://www.idisantiago.es/bin/XWQL/SnapshotE0012012
>
> Both users have three comments each. This way:
>
> XWD_ID:416379378
> Gender:
> Withdrawal:20121017
> Formely:XWiki.XWikiIDISE001
>
> XWD_ID:946660794
> Gender:
> Withdrawal:20111231
> Formely:XWiki.XWikiIDISE001
>
> Thus, I'm still not able to design a query to retrive ONLY user
> XWD_ID:416379378 based on comments :-( Your proposals answer with a list
> including both users n times. I'm not able neither of explain n in both
> cases... any idea will be welcome!
>
> Thank you very much for your help,
>
> Ricardo
>
>
> > 
> > From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of
> Guillaume "Louis-Marie" Delhumeau [gdelhum...@xwiki.com]
> > Sent: 22 May 2013 13:02
> > To: XWiki Users
> > Subject: Re: [xwiki-users] XWQL query on several objects of the same
> class instantiated in the same doc
> >
> > Hi Ricardo and Edo,
> >
> > 2013/5/22 Edo Beutler 
> >
> >> Hi Ricardo
> >>
> >> You are only checking in one object. So there has to be one object that
> >> contains the doc name, but not the withdrawal part which is fulfilled by
> >> the third object in your example. Whilst I don't recall ever having
> tried
> >> checking for multiple objects in XWQL, I would suspect this should work:
> >>
> >> #set ($xwlquery1 = "from doc.object(XWiki.XWikiComments) as comm1,
> >> doc.object(XWiki.XWikiComments) as comm2 where doc.translation = 0 and
> >> comm1.comment like '%$doc.title%' and comm2.comment not like
> >> '%Withdrawal:2011%'")
> >>
> >
> > You are right. But I think you should add "comm1 <> comm2" in your query
> to
> > make it work.
> >
> > Louis-Marie
> > ___
> > users mailing list
> > users@xwiki.org
> > http://lists.xwiki.org/mailman/listinfo/users
>
> Nota: A información contida nesta mensaxe e os seus posibles documentos
> adxuntos é privada e confidencial e está dirixida únicamente ó seu
> destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe,
> por favor elimínea. A distribución ou copia desta mensaxe non está
> autorizada.
>
> Nota: La información contenida en este mensaje y sus posibles documentos
> adjuntos es privada y confidencial y está dirigida únicamente a su
> destinatario/a. Si usted no es el/la destinatario/a original de este
> mensaje, por favor elimínelo. La distribución o copia de este mensaje no
> está autorizada.
>
> See more languages: http://www.sergas.es/aviso_confidencialidad.htm
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-22 Thread Ricardo.Julio.Rodriguez.Fernandez
Hi! Thanks you both for answering!

I'm afraid that your proposals didn't solve the problem. Please, see here...

http://www.idisantiago.es/bin/XWQL/SnapshotE0012012

Both users have three comments each. This way:

XWD_ID:416379378
Gender:
Withdrawal:20121017
Formely:XWiki.XWikiIDISE001

XWD_ID:946660794
Gender:
Withdrawal:20111231
Formely:XWiki.XWikiIDISE001

Thus, I'm still not able to design a query to retrive ONLY user 
XWD_ID:416379378 based on comments :-( Your proposals answer with a list 
including both users n times. I'm not able neither of explain n in both 
cases... any idea will be welcome!

Thank you very much for your help,

Ricardo


> 
> From: users-boun...@xwiki.org [users-boun...@xwiki.org] On Behalf Of 
> Guillaume "Louis-Marie" Delhumeau [gdelhum...@xwiki.com]
> Sent: 22 May 2013 13:02
> To: XWiki Users
> Subject: Re: [xwiki-users] XWQL query on several objects of the same class 
> instantiated in the same doc
>
> Hi Ricardo and Edo,
>
> 2013/5/22 Edo Beutler 
>
>> Hi Ricardo
>>
>> You are only checking in one object. So there has to be one object that
>> contains the doc name, but not the withdrawal part which is fulfilled by
>> the third object in your example. Whilst I don't recall ever having tried
>> checking for multiple objects in XWQL, I would suspect this should work:
>>
>> #set ($xwlquery1 = "from doc.object(XWiki.XWikiComments) as comm1,
>> doc.object(XWiki.XWikiComments) as comm2 where doc.translation = 0 and
>> comm1.comment like '%$doc.title%' and comm2.comment not like
>> '%Withdrawal:2011%'")
>>
>
> You are right. But I think you should add "comm1 <> comm2" in your query to
> make it work.
>
> Louis-Marie
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users

Nota: A información contida nesta mensaxe e os seus posibles documentos 
adxuntos é privada e confidencial e está dirixida únicamente ó seu 
destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por 
favor elimínea. A distribución ou copia desta mensaxe non está autorizada.

Nota: La información contenida en este mensaje y sus posibles documentos 
adjuntos es privada y confidencial y está dirigida únicamente a su 
destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, 
por favor elimínelo. La distribución o copia de este mensaje no está autorizada.

See more languages: http://www.sergas.es/aviso_confidencialidad.htm
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-22 Thread Guillaume "Louis-Marie" Delhumeau
Hi Ricardo and Edo,

2013/5/22 Edo Beutler 

> Hi Ricardo
>
> You are only checking in one object. So there has to be one object that
> contains the doc name, but not the withdrawal part which is fulfilled by
> the third object in your example. Whilst I don't recall ever having tried
> checking for multiple objects in XWQL, I would suspect this should work:
>
> #set ($xwlquery1 = "from doc.object(XWiki.XWikiComments) as comm1,
> doc.object(XWiki.XWikiComments) as comm2 where doc.translation = 0 and
> comm1.comment like '%$doc.title%' and comm2.comment not like
> '%Withdrawal:2011%'")
>

You are right. But I think you should add "comm1 <> comm2" in your query to
make it work.

Louis-Marie
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-22 Thread Edo Beutler
Hi Ricardo

You are only checking in one object. So there has to be one object that
contains the doc name, but not the withdrawal part which is fulfilled by
the third object in your example. Whilst I don't recall ever having tried
checking for multiple objects in XWQL, I would suspect this should work:

#set ($xwlquery1 = "from doc.object(XWiki.XWikiComments) as comm1,
doc.object(XWiki.XWikiComments) as comm2 where doc.translation = 0 and
comm1.comment like '%$doc.title%' and comm2.comment not like
'%Withdrawal:2011%'")

Hope this helps
Edo


On Wed, May 22, 2013 at 2:57 AM, <
ricardo.julio.rodriguez.fernan...@sergas.es> wrote:

> Hi!,
>
> I'm really impressed, again, with the performance and easiness of XWQL.
> Even though I'm using an old XWiki release, I'm able to follow almost all
> examples provided at...
>
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module
>
> But I'm not able to figure out how to solve one problem: I would like to
> retrieve documents (and read their properties) based on a combination of
> values of comments objects. That is: I only want to retrieve a document
> when a combination of values stored in comments happens.
>
> I've tried this...
>
> #set ($xwlquery1 = "from doc.object(XWiki.XWikiComments) as comm where
> doc.translation = 0 and comm.comment like '%$doc.title%' and comm.comment
> not like '%Withdrawal:2011%'")
>
> But this query retrieve also, for instance, this document holding three
> comments:
>
> Ricardo Rodríguez Fernández, 2012/06/15 07:49
> Reply Edit Delete
> Gender:male
>
> Yolanda Liste Martínez, 2012/06/15 09:18
> Reply Delete
> Withdrawal:20111231
>
> Ricardo Rodríguez Fernández, 2013/05/21 13:24
> Reply Edit Delete
> Formely:XWiki.XWikiIDISE001
>
> I'm not able to find a way of not to retrieve this document while all
> others with comm.comment like '%$doc.title%'.
>
> Please, could anybody help me with this issue?
>
> Thank you so much for your help,
>
> Ricardo
>
>
> --
> Ricardo Rodríguez
> Research Management and Promotion Technician
> Technical Secretariat
> Health Research Institute of Santiago de Compostela (IDIS)
> http://www.idisantiago.es
>
> Nota: A información contida nesta mensaxe e os seus posibles documentos
> adxuntos é privada e confidencial e está dirixida únicamente ó seu
> destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe,
> por favor elimínea. A distribución ou copia desta mensaxe non está
> autorizada.
>
> Nota: La información contenida en este mensaje y sus posibles documentos
> adjuntos es privada y confidencial y está dirigida únicamente a su
> destinatario/a. Si usted no es el/la destinatario/a original de este
> mensaje, por favor elimínelo. La distribución o copia de este mensaje no
> está autorizada.
>
> See more languages: http://www.sergas.es/aviso_confidencialidad.htm
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] XWQL query on several objects of the same class instantiated in the same doc

2013-05-21 Thread Ricardo.Julio.Rodriguez.Fernandez
Hi!,

I'm really impressed, again, with the performance and easiness of XWQL. Even 
though I'm using an old XWiki release, I'm able to follow almost all examples 
provided at...

http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module

But I'm not able to figure out how to solve one problem: I would like to 
retrieve documents (and read their properties) based on a combination of values 
of comments objects. That is: I only want to retrieve a document when a 
combination of values stored in comments happens.

I've tried this...

#set ($xwlquery1 = "from doc.object(XWiki.XWikiComments) as comm where 
doc.translation = 0 and comm.comment like '%$doc.title%' and comm.comment not 
like '%Withdrawal:2011%'")

But this query retrieve also, for instance, this document holding three 
comments:

Ricardo Rodríguez Fernández, 2012/06/15 07:49
Reply Edit Delete
Gender:male

Yolanda Liste Martínez, 2012/06/15 09:18
Reply Delete
Withdrawal:20111231

Ricardo Rodríguez Fernández, 2013/05/21 13:24
Reply Edit Delete
Formely:XWiki.XWikiIDISE001

I'm not able to find a way of not to retrieve this document while all others 
with comm.comment like '%$doc.title%'.

Please, could anybody help me with this issue?

Thank you so much for your help,

Ricardo


--
Ricardo Rodríguez
Research Management and Promotion Technician
Technical Secretariat
Health Research Institute of Santiago de Compostela (IDIS)
http://www.idisantiago.es

Nota: A información contida nesta mensaxe e os seus posibles documentos 
adxuntos é privada e confidencial e está dirixida únicamente ó seu 
destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por 
favor elimínea. A distribución ou copia desta mensaxe non está autorizada.

Nota: La información contenida en este mensaje y sus posibles documentos 
adjuntos es privada y confidencial y está dirigida únicamente a su 
destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, 
por favor elimínelo. La distribución o copia de este mensaje no está autorizada.

See more languages: http://www.sergas.es/aviso_confidencialidad.htm
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users