Michael Seiferle gave the answer already, I think. What would collection() be referring to? How would BaseX know what to return? Probably there is no database specified. Presumably, in the GUI you have opened a database.
Kendall From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of AJ Weber <awe...@comcast.net> Date: Friday, March 10, 2017 at 6:44 AM To: Fabrice ETANCHAUD <fetanch...@groupefbo.com>, "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de> Subject: Re: [basex-talk] Simple query On 3/9/2017 3:46 AM, Fabrice ETANCHAUD wrote: Hello Aaron, You would learn faster by using the BaseXGUI application, You will benefit from syntax highlighting, real time execution, and hits on function signatures. I am trying the GUI now. It is an excellent tool! However, issuing the same exact XQuery in the GUI returns 3 documents (which is what I would have originally expected). Maybe it is an issue with how I setup my query in java? Here is my code: try (LocalSession session = new LocalSession(this.context)) { //test try (Query q = session.query("for $doc in collection() return $doc")) { while (q.more()) { LOG.debug("RESULT: " + q.next()); } } } catch (Exception e) { LOG.error("Could not execute query " + statement, e); } Best regards, Fabrice De : basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de> [mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de Aaron Weber Envoyé : jeudi 9 mars 2017 00:31 À : basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de> Objet : [basex-talk] Simple query Newbie alert. I'm trying to get my feet wet with BaseX, and in doing so, am trying to understand XQuery and how to apply it to a database full of documents (not just a single document that is typically queried). I am using Java and can post my code, but with a LocalSession, and a query, the following produces 0 results. For $doc in collection() return $doc I realize there's no "where", and in the sql world that would match all. Maybe not in XQuery? Obviously just a test query, but I need to start somewhere. :-) Thanks for any help! -- AJ