On 11/12/2012 07:57 PM, crocket wrote:
Isn't doc.object(Class) part of XWiki core API?
I thought it was an alias of $doc.getObject("Class")
XWQL doesn't have access to any API method. It's not a scripting
language, it's a query language.
doc.object(Class) is supposed to be read as:
search for documents that [meet some other conditions] and have an
object of type "Class"
You don't actually get the object as you would in a scripting
environment. That part of the query will get translated into some SQL
FROM and WHERE fragments, like all the other parts of the XWQL query.
Remember, you're writing a *query*, not a script.
I want to know what APIs XWQL has access to, but I
couldn't find the
information.
On Mon, Nov 12, 2012 at 11:42 PM, Jeremie BOUSQUET <
jeremie.bousquet(a)gmail.com> wrote:
> doc.getObjects("MyClass") is from the xwiki core java api, but is not part
> of the XWQL querying language.
>
> The query:
>
> select srv.port from Document doc, doc.object(Private.Network Services) as
> srv order by srv.port
>
> ... translates to " select "port" field from all XObjects that are of
> class "Private.Network Services", ordering by "port" field
"
> So this query would retrieve the value of "port" field from all of these
> XObjects (that we name "srv" in the query), wherever they are and whatever
> their count.
>
>
>
>
> 2012/11/12 crocket <crockabiscuit(a)gmail.com>
>
>> doc.getObjects was there since I had multiple instance of the same class.
>>
>>
>>
>> On Mon, Nov 12, 2012 at 8:32 PM, Jeremie BOUSQUET <
>> jeremie.bousquet(a)gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I think this is not correct:
>>> select srv from IN (doc.getObjects("Private.Network Services")) srv
order
>>> by srv.port
>>>
>>> Should be more something like:
>>> select srv.port from Document doc, doc.object(Private.Network Services)
>>> as
>>> srv order by srv.port
>>>
>>> Replacing the "select srv.port" by what fields you want to
retrieve.
>>>
>>> Though obviously I'm not sure about what you wanted to achieve with your
>>> request to start with ...
>>>
>>> Br,
>>> Jeremie
>>>
>>>
>>> 2012/11/12 crocket <crockabiscuit(a)gmail.com>
>>>
>>>> Yes, I read it, and it seems collection member declarations don't
work
>>> in
>>>> xwiki.
>>>>
>>>>
>>>> On Mon, Nov 12, 2012 at 6:13 PM, Jerome Velociter
<jerome(a)velociter.fr
>>>>> wrote:
>>>>
>>>>> Le 12/11/12 09:37, crocket a écrit :
>>>>>
>>>>> I tried to execute a Query and saw an error below.
>>>>>>
>>>>>> Caused by: org.xwiki.query.**QueryException: Exception while
>>> translating
>>>>>> [select srv from IN (doc.getObjects("Private.**Network
Services"))
>>> srv
>>>>>> order by srv.port] XWQL query to the [hql] language. Query
>>> statement =
>>>>>> [select srv from IN (doc.getObjects("Private.**Network
Services"))
>>> srv
>>>>>> order by srv.port]
>>>>>>
>>>>>> Although I read JPQL documents, I couldn't come out with an
answer.
>>>>>>
>>>>>> Does anybody know how to write a correct XWQL statement?
>>>>>>
>>>>>
>>>>> Have you read
>>>
http://extensions.xwiki.org/**xwiki/bin/view/Extension/**
>>>>> Query+Module#**HQueryLanguageExamples<
>>>>
>>>
http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module#HQueryLan…
>>>>> ?
>>>>>
>>>>> Jerome
--
Sergiu Dumitriu
http://purl.org/net/sergiu/