You need to send messages to both me and xwiki-users list. Everybody should share knowledges. What I want to do is extract all object of a class from a specific page, not the entire objects from the wiki database. How should I modify the query in this case? And where can I find all those XWQL object model references? (Yes, it reminds me of DOM) doc.object, etc, ... On Tue, Nov 13, 2012 at 5:59 PM, Jeremie BOUSQUET < [email protected]> wrote:
Well, it's not because the name is the same that it's the same method or API ... :)
XWiki core api is a Java api, available to components and scripts (velocity, groovy ...). It provides access to documents as well as various features of the wiki.
XWQL is a query language, superset of JPQL (Java Persistence Query Language ?) with some differences. You use it to query the data stored in the database. One of the differences between jpql/xwql is the syntax "doc.object(MyClass)" that selects all XObjects belonging to a particular XClass from the database. Apart from that, if you know JPQL then you mostly know XWQL.
("doc.getObject("MyClass")" , from java api, retrieves XObjects of a particular XClass from specified document only (and not from the whole wiki).)
2012/11/13 crocket <[email protected]>
Isn't doc.object(Class) part of XWiki core API? I thought it was an alias of $doc.getObject("Class")
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 < [email protected]> 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 <[email protected]>
doc.getObjects was there since I had multiple instance of the same class.
On Mon, Nov 12, 2012 at 8:32 PM, Jeremie BOUSQUET < [email protected]> 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 <[email protected]>
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 < [email protected] >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#HQueryLang...
>? > > Jerome > >> ______________________________**_________________ >> users mailing list >> [email protected] >> http://lists.xwiki.org/**mailman/listinfo/users< http://lists.xwiki.org/mailman/listinfo/users> >> > > ______________________________**_________________ > users mailing list > [email protected] > http://lists.xwiki.org/**mailman/listinfo/users< http://lists.xwiki.org/mailman/listinfo/users> > _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users