---------- Forwarded message ---------- From: marco fregonese <marcofregonese@gmail.com> Date: 2013/1/21 Subject: Re: [basex-talk] dynamic web application, XQJ, BaseX To: Christian Grün <christian.gruen@gmail.com> There is a class in my Java web application that has a method that, after connecting to my BaseX database, execute a query on it. This query (associated to the "xquerystring" variable), after importing a library module and pointing the processor to the file containing the library module("library_module.xq"), uses the function "lib:getparts()". Now, after executing this method, I noticed that: with BaseX 7.3 the Xquery processor (o whatever it is, I don't know) looks for "library_module.xq" in the filesystem $HOME/basex/bin, while with BaseX 7.5 the processor looks for "library_module.xq" in $HOME. My question basically is: what is that makes the processor (or whatever it is) look for the file "library_module.xq" in $HOME/basex/bin (with BaseX 7.3) and in $HOME (with BaseX 7.5)? Hope I've been clear. Thanks PS: in BaseX GUI everything works fine: the XQuery processor looks for the file containing the library module in the same folder where the main module is. Example of main module: import module namespace lib="http://www.example.com/my_library_module" at "library_module.xq"; lib:getparts() The following is the code of the class I've talked about: package xqu; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import javax.xml.namespace.QName; import javax.xml.xquery.XQConnection; import javax.xml.xquery.XQException; import javax.xml.xquery.XQExpression; import javax.xml.xquery.XQResultSequence; import con.Connection; public class Query { public static void getAllParts(String a, String sc) throws XQException, FileNotFoundException { File file = new File(sc); FileOutputStream fos = new FileOutputStream(file); PrintStream ps = new PrintStream(fos); System.setOut(ps); XQConnection con = Connection.getConnection(); XQExpression xqe = con.createExpression(); xqe.bindString(new QName("b"), a, null); String xqueryString = // using backslash for escaping " "import module namespace lib=\" http://www.example.com/library_module\"" + "at \"library_module.xq\";" + "declare variable $b external; " + "lib:getparts($b)"; XQResultSequence rs = xqe.executeQuery(xqueryString); String b = rs.getSequenceAsString(null); con.close(); System.out.println(b); } } 2013/1/20 Christian Grün <christian.gruen@gmail.com>
Hi Marco,
sorry for the late feedback. Can you reproduce the issues in the BaseX GUI or on command line?
Best, Christian ___________________________________