Generic-user-small Juan E. Murillo 1 post

After downloading the example files for the book, I followed the instructions to set up the xQuery code with eXist but I cannot get the data to load to the database. I used eXist because there is no downloadable version of marklogic for Mac OS X (the operating system I use).

I get the following error message when loading default.xqy into the browser and
then clicking on the “Load” button – please note that I followed all instructions and did not change any default installation path for eXist:

Error found

Could not locate collection: /pragmatic/code/marklogic [at line 20, column 9]

XQuery Stack Trace
local:load-dir(xs:string, xs:string, xs:string, xs:string) 59:38
Java Stack Trace:
Class Name Method Name File Name Line
org.exist.xquery.functions.xmldb.XMLDBAbstractCollectionManipulator eval
XMLDBAbstractCollectionManipulator.java 134
org.exist.xquery.BasicFunction eval BasicFunction.java 68
org.exist.xquery.InternalFunctionCall eval InternalFunctionCall.java 50
org.exist.xquery.AbstractExpression eval AbstractExpression.java 59
org.exist.xquery.PathExpr eval PathExpr.java 242
org.exist.xquery.UserDefinedFunction eval UserDefinedFunction.java 122
org.exist.xquery.FunctionCall evalFunction FunctionCall.java 223
org.exist.xquery.FunctionCall eval FunctionCall.java 161
org.exist.xquery.AbstractExpression eval AbstractExpression.java 59
org.exist.xquery.PathExpr eval PathExpr.java 242
org.exist.xquery.ForExpr eval ForExpr.java 183
org.exist.xquery.BindingExpression eval BindingExpression.java 158
org.exist.xquery.AbstractExpression eval AbstractExpression.java 59
org.exist.xquery.PathExpr eval PathExpr.java 242
org.exist.xquery.EnclosedExpr eval EnclosedExpr.java 68
org.exist.xquery.AbstractExpression eval AbstractExpression.java 59
org.exist.xquery.PathExpr eval PathExpr.java 242
org.exist.xquery.ElementConstructor eval ElementConstructor.java 237
org.exist.xquery.AbstractExpression eval AbstractExpression.java 59
org.exist.xquery.PathExpr eval PathExpr.java 242

 
Generic-user-small Pete Aven 1 post

Hi Juan,

I had the same issue. I was able to create the collections using the exist sandbox (http://localhost:8080/exist/sandbox/sandbox.xql)
In the sandbox evaluate the following ( I ran one at a time )

xmldb:create-collection (”/”, “marklogic”)
xmldb:create-collection (”/”, “xquery1.0”)
xmldb:create-collection (”/”, “common”)
xmldb:create-collection (”/”, “exist”)

Once I created the collections, by evaluating the above, I could then run loaddata.xqy successfully and was in business.

 
Ronh_head_small_small Ron Hitchens 1 post

OK, so I made a last minute change to where the source code is loaded and missed an update to the eXist loader script. I’ve updated the sources in Pragmatic’s svn repository, but if you’ve already downloaded the source-ball then you may also encounter this issue.

You can fix it by adding a single line to the file pragmatic/exist/loaddata.xqy in the unpacked .zip file. At about line 20, add a line to the function local:load-dir so that it looks like this (don’t forget the comma):


declare function local:load-dir ($coll as xs:string,
        $fsdir as xs:string,
        $pattern as xs:string, $mime-type as xs:string)
{
        local:insure-collection($coll),
        xmldb:store-files-from-pattern ($coll,
                $fsdir, $pattern, $mime-type, true())
};

That should do it – just hit the Load button again. Sorry for the hassle.

3 posts, 3 voices