XPDY0002 :undefined context sequence for 'child::test.xql' error when I schedule a xquery file

View: New views
5 Messages — Rating Filter:   Alert me  

XPDY0002 :undefined context sequence for 'child::test.xql' error when I schedule a xquery file

by thomas.0007 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have been trying run a scheduled xquery but I receive the following
an error (in the scheduler.log) :
2008-05-13 12:52:00,015 [DefaultQuartzScheduler_Worker-4] INFO
(JobRunShell.java [run]:207) - Job eXist.User.XQuery:
/db/test/test.xql threw a JobExecutionException:
org.quartz.JobExecutionException: UserXQueryJob Failed: XPathException
in the Job: XPDY0002 : undefined context sequence for
'child::test.xql'! Unscheduling UserXQueryJob.
at org.exist.scheduler.UserXQueryJob.abort(UserXQueryJob.java:214)
at org.exist.scheduler.UserXQueryJob.execute(UserXQueryJob.java:199)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)

I can't go any further and I will really appreciate any help.

Regards,
Tom


Bellow is the code I am trying to run:
----- run-test.xql  -----

xquery version "1.0"  encoding "UTF-8";

declare default function namespace "http://www.w3.org/2005/xpath-functions";
declare namespace request="http://exist-db.org/xquery/request";
declare namespace xdb="http://exist-db.org/xquery/xmldb";

declare boundary-space strip;
declare option exist:serialize "method=xml media-type=text/xml";

let $login := xmldb:login( "/db", "admin", "pass" )
let $sheduled := 'test.xql'
let $coll-path := '/db/test'
let $xquery-path := concat(  $coll-path, '/', $sheduled )

let $cron := '0,10,20,30,40,50 * *  * * ?'

let $mode := request:request-parameter('mode', 'check')
let $collection-ok := if(  not( xdb:collection-exists ( $coll-path ))  )
          then  xdb:create-collection( '/db' ,  'test' )
          else ()

let $result :=
     if( $mode = 'start' )
      then (
          scheduler:delete-scheduled-job(  concat(   'XQuery: ',
$xquery-path )   ),
          xdb:store(   $coll-path,  $sheduled,  $sheduled ),
          scheduler:schedule-xquery-cron-job( $xquery-path,  $cron )
      )else if( $mode = 'stop' )
       then (
           scheduler:delete-scheduled-job(  concat(   'XQuery: ',
$xquery-path )   )
      )else ()

return
     <result>
           { $result }
            { scheduler:get-scheduled-jobs()//scheduler:group[
@name="eXist.User" ]  }
     </result>

----- test.xql ------------------
xquery version "1.0"  encoding "UTF-8";

declare default function namespace "http://www.w3.org/2005/xpath-functions";
declare namespace xdb="http://exist-db.org/xquery/xmldb";

declare boundary-space strip;
declare option exist:serialize "method=xhtml media-type=text/html
omit-xml-declaration=no indent=yes";

let $login := xdb:login( "/db", "admin", "pass" )

let $log := 'log.xml'
let $coll-path := '/db/test'
let $log-path := concat(  $coll-path, '/', $log )

let $step := <test >{ current-time() }</test>

let $temp :=  update insert  $step  into doc( $log-path  )/*

return
    <div>
       { $step }
   </div>

--- log.xml --
<root/>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: XPDY0002 :undefined context sequence for 'child::test.xql' error when I schedule a xquery file

by Adam Retter-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmm this doesnt make too much sense in places!

Particularly this line -  xdb:store(   $coll-path,  $sheduled,  $sheduled ),

I understand you have a control script and you want to store an xquery
into the database, however in the query you posted you never store the
data of the xquery into the db. The above stores the file
/db/test/test.xql with the content "test.xql" ?!?



2008/5/13 Thomas White <thomas.0007@...>:

> I have been trying run a scheduled xquery but I receive the following
>  an error (in the scheduler.log) :
>  2008-05-13 12:52:00,015 [DefaultQuartzScheduler_Worker-4] INFO
>  (JobRunShell.java [run]:207) - Job eXist.User.XQuery:
>  /db/test/test.xql threw a JobExecutionException:
>  org.quartz.JobExecutionException: UserXQueryJob Failed: XPathException
>  in the Job: XPDY0002 : undefined context sequence for
>  'child::test.xql'! Unscheduling UserXQueryJob.
>  at org.exist.scheduler.UserXQueryJob.abort(UserXQueryJob.java:214)
>  at org.exist.scheduler.UserXQueryJob.execute(UserXQueryJob.java:199)
>  at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
>  at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
>
>  I can't go any further and I will really appreciate any help.
>
>  Regards,
>  Tom
>
>
>  Bellow is the code I am trying to run:
>  ----- run-test.xql  -----
>
>  xquery version "1.0"  encoding "UTF-8";
>
>  declare default function namespace "http://www.w3.org/2005/xpath-functions";
>  declare namespace request="http://exist-db.org/xquery/request";
>  declare namespace xdb="http://exist-db.org/xquery/xmldb";
>
>  declare boundary-space strip;
>  declare option exist:serialize "method=xml media-type=text/xml";
>
>  let $login := xmldb:login( "/db", "admin", "pass" )
>  let $sheduled := 'test.xql'
>  let $coll-path := '/db/test'
>  let $xquery-path := concat(  $coll-path, '/', $sheduled )
>
>  let $cron := '0,10,20,30,40,50 * *  * * ?'
>
>  let $mode := request:request-parameter('mode', 'check')
>  let $collection-ok := if(  not( xdb:collection-exists ( $coll-path ))  )
>           then  xdb:create-collection( '/db' ,  'test' )
>           else ()
>
>  let $result :=
>      if( $mode = 'start' )
>       then (
>           scheduler:delete-scheduled-job(  concat(   'XQuery: ',
>  $xquery-path )   ),
>           xdb:store(   $coll-path,  $sheduled,  $sheduled ),
>           scheduler:schedule-xquery-cron-job( $xquery-path,  $cron )
>       )else if( $mode = 'stop' )
>        then (
>            scheduler:delete-scheduled-job(  concat(   'XQuery: ',
>  $xquery-path )   )
>       )else ()
>
>  return
>      <result>
>            { $result }
>             { scheduler:get-scheduled-jobs()//scheduler:group[
>  @name="eXist.User" ]  }
>      </result>
>
>  ----- test.xql ------------------
>  xquery version "1.0"  encoding "UTF-8";
>
>  declare default function namespace "http://www.w3.org/2005/xpath-functions";
>  declare namespace xdb="http://exist-db.org/xquery/xmldb";
>
>  declare boundary-space strip;
>  declare option exist:serialize "method=xhtml media-type=text/html
>  omit-xml-declaration=no indent=yes";
>
>  let $login := xdb:login( "/db", "admin", "pass" )
>
>  let $log := 'log.xml'
>  let $coll-path := '/db/test'
>  let $log-path := concat(  $coll-path, '/', $log )
>
>  let $step := <test >{ current-time() }</test>
>
>  let $temp :=  update insert  $step  into doc( $log-path  )/*
>
>  return
>     <div>
>        { $step }
>    </div>
>
>  --- log.xml --
>  <root/>
>
>  -------------------------------------------------------------------------
>  This SF.net email is sponsored by: Microsoft
>  Defy all challenges. Microsoft(R) Visual Studio 2008.
>  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>  _______________________________________________
>  Exist-open mailing list
>  Exist-open@...
>  https://lists.sourceforge.net/lists/listinfo/exist-open
>



--
Adam Retter

eXist Developer
{ England }
adam@...
irc://irc.freenode.net/existdb

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Parent Message unknown Re: XPDY0002 :undefined context sequence for 'child::test.xql' error when I schedule a xquery file

by Adam Retter-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

xdb:store() does not do what you think it does!

I suspect you want something more like xdb:store($coll-path,
$sheduler, binary-doc(concat("/path/to/original/", $sheduled)))

2008/5/13 Thomas White <thomas.0007@...>:

> Adam,
>
>  I am new in XQuery and the I have not adopted a clear programing style jet.
>  May be that is why it is not obvious what I am doing.
>
>
>  xdb:store(   $coll-path,  $sheduled,  $sheduled )
>  copies a fresh copy of the test.xql file from the current directory
>  into /db/test collection as /db/test/test.xql .
>
>  This line in /db/test/test.xql
>
>       let $temp :=  update insert  $step  into doc( $log-path  )/*
>  stores a line into /db/test/log.xml every time when /db/test/test.xql
>  is executed.
>  When I execute test.xql manually it works.
>
>  I hope now is clear what I am trying to achieve.
>
>  Regards,
>  Tom
>
>
>
>
>
>
>  On 13/05/2008, Adam Retter <adam@...> wrote:
>  > Hmm this doesnt make too much sense in places!
>  >
>  > Particularly this line -  xdb:store(   $coll-path,  $sheduled,  $sheduled ),
>  >
>  > I understand you have a control script and you want to store an xquery
>  > into the database, however in the query you posted you never store the
>  > data of the xquery into the db. The above stores the file
>  > /db/test/test.xql with the content "test.xql" ?!?
>  >
>  >
>  >
>  > 2008/5/13 Thomas White <thomas.0007@...>:
>  > > I have been trying run a scheduled xquery but I receive the following
>  > >  an error (in the scheduler.log) :
>  > >  2008-05-13 12:52:00,015 [DefaultQuartzScheduler_Worker-4] INFO
>  > >  (JobRunShell.java [run]:207) - Job eXist.User.XQuery:
>  > >  /db/test/test.xql threw a JobExecutionException:
>  > >  org.quartz.JobExecutionException: UserXQueryJob Failed: XPathException
>  > >  in the Job: XPDY0002 : undefined context sequence for
>  > >  'child::test.xql'! Unscheduling UserXQueryJob.
>  > >  at org.exist.scheduler.UserXQueryJob.abort(UserXQueryJob.java:214)
>  > >  at org.exist.scheduler.UserXQueryJob.execute(UserXQueryJob.java:199)
>  > >  at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
>  > >  at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
>  > >
>  > >  I can't go any further and I will really appreciate any help.
>  > >
>  > >  Regards,
>  > >  Tom
>  > >
>  > >
>  > >  Bellow is the code I am trying to run:
>  > >  ----- run-test.xql  -----
>  > >
>  > >  xquery version "1.0"  encoding "UTF-8";
>  > >
>  > >  declare default function namespace "http://www.w3.org/2005/xpath-functions";
>  > >  declare namespace request="http://exist-db.org/xquery/request";
>  > >  declare namespace xdb="http://exist-db.org/xquery/xmldb";
>  > >
>  > >  declare boundary-space strip;
>  > >  declare option exist:serialize "method=xml media-type=text/xml";
>  > >
>  > >  let $login := xmldb:login( "/db", "admin", "pass" )
>  > >  let $sheduled := 'test.xql'
>  > >  let $coll-path := '/db/test'
>  > >  let $xquery-path := concat(  $coll-path, '/', $sheduled )
>  > >
>  > >  let $cron := '0,10,20,30,40,50 * *  * * ?'
>  > >
>  > >  let $mode := request:request-parameter('mode', 'check')
>  > >  let $collection-ok := if(  not( xdb:collection-exists ( $coll-path ))  )
>  > >           then  xdb:create-collection( '/db' ,  'test' )
>  > >           else ()
>  > >
>  > >  let $result :=
>  > >      if( $mode = 'start' )
>  > >       then (
>  > >           scheduler:delete-scheduled-job(  concat(   'XQuery: ',
>  > >  $xquery-path )   ),
>  > >           xdb:store(   $coll-path,  $sheduled,  $sheduled ),
>  > >           scheduler:schedule-xquery-cron-job( $xquery-path,  $cron )
>  > >       )else if( $mode = 'stop' )
>  > >        then (
>  > >            scheduler:delete-scheduled-job(  concat(   'XQuery: ',
>  > >  $xquery-path )   )
>  > >       )else ()
>  > >
>  > >  return
>  > >      <result>
>  > >            { $result }
>  > >             { scheduler:get-scheduled-jobs()//scheduler:group[
>  > >  @name="eXist.User" ]  }
>  > >      </result>
>  > >
>  > >  ----- test.xql ------------------
>  > >  xquery version "1.0"  encoding "UTF-8";
>  > >
>  > >  declare default function namespace "http://www.w3.org/2005/xpath-functions";
>  > >  declare namespace xdb="http://exist-db.org/xquery/xmldb";
>  > >
>  > >  declare boundary-space strip;
>  > >  declare option exist:serialize "method=xhtml media-type=text/html
>  > >  omit-xml-declaration=no indent=yes";
>  > >
>  > >  let $login := xdb:login( "/db", "admin", "pass" )
>  > >
>  > >  let $log := 'log.xml'
>  > >  let $coll-path := '/db/test'
>  > >  let $log-path := concat(  $coll-path, '/', $log )
>  > >
>  > >  let $step := <test >{ current-time() }</test>
>  > >
>  > >  let $temp :=  update insert  $step  into doc( $log-path  )/*
>  > >
>  > >  return
>  > >     <div>
>  > >        { $step }
>  > >    </div>
>  > >
>  > >  --- log.xml --
>  > >  <root/>
>  > >
>  > >  -------------------------------------------------------------------------
>  > >  This SF.net email is sponsored by: Microsoft
>  > >  Defy all challenges. Microsoft(R) Visual Studio 2008.
>  > >  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>  > >  _______________________________________________
>  > >  Exist-open mailing list
>  > >  Exist-open@...
>  > >  https://lists.sourceforge.net/lists/listinfo/exist-open
>  > >
>  >
>  >
>  >
>  > --
>  > Adam Retter
>  >
>  > eXist Developer
>  > { England }
>  > adam@...
>  > irc://irc.freenode.net/existdb
>  >
>
>
>  --
>  Thomas White
>
>  51 Glebewood
>  Bracknell
>  Berks RG12 9SD
>  Mobile:+44 7711 922 966
>  Skype: thomaswhite
>  gTalk: thomas.0007
>  jaxtr: http://www.jaxtr.com/t.white
>  Linked-In:http://www.linkedin.com/in/thomaswhite0007
>



--
Adam Retter

eXist Developer
{ England }
adam@...
irc://irc.freenode.net/existdb

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: XPDY0002 :undefined context sequence for 'child::test.xql' error when I schedule a xquery file

by thomas.0007 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Adam,

Thank you very much for your help! Not my code is working.

Bellow is the a line of code that will copy xquery files  to a collection,
from the directory where the running xquery file is located :

xdb:store-files-from-pattern(  $collection-path,
system:get-module-load-path(),  $xquery-to-copy-file-pattern,
'application/xquery' )

Kind regards.
Tom


On 13/05/2008, Adam Retter <adam@...> wrote:

> xdb:store() does not do what you think it does!
>
> I suspect you want something more like xdb:store($coll-path,
> $sheduler, binary-doc(concat("/path/to/original/", $sheduled)))
>
> 2008/5/13 Thomas White <thomas.0007@...>:
> > Adam,
> >
> >  I am new in XQuery and the I have not adopted a clear programing style jet.
> >  May be that is why it is not obvious what I am doing.
> >
> >
> >  xdb:store(   $coll-path,  $sheduled,  $sheduled )
> >  copies a fresh copy of the test.xql file from the current directory
> >  into /db/test collection as /db/test/test.xql .
> >
> >  This line in /db/test/test.xql
> >
> >       let $temp :=  update insert  $step  into doc( $log-path  )/*
> >  stores a line into /db/test/log.xml every time when /db/test/test.xql
> >  is executed.
> >  When I execute test.xql manually it works.
> >
> >  I hope now is clear what I am trying to achieve.
> >
> >  Regards,
> >  Tom
> >
> >
> >
> >
> >
> >
> >  On 13/05/2008, Adam Retter <adam@...> wrote:
> >  > Hmm this doesnt make too much sense in places!
> >  >
> >  > Particularly this line -  xdb:store(   $coll-path,  $sheduled,  $sheduled ),
> >  >
> >  > I understand you have a control script and you want to store an xquery
> >  > into the database, however in the query you posted you never store the
> >  > data of the xquery into the db. The above stores the file
> >  > /db/test/test.xql with the content "test.xql" ?!?
> >  >
> >  >
> >  >
> >  > 2008/5/13 Thomas White <thomas.0007@...>:
> >  > > I have been trying run a scheduled xquery but I receive the following
> >  > >  an error (in the scheduler.log) :
> >  > >  2008-05-13 12:52:00,015 [DefaultQuartzScheduler_Worker-4] INFO
> >  > >  (JobRunShell.java [run]:207) - Job eXist.User.XQuery:
> >  > >  /db/test/test.xql threw a JobExecutionException:
> >  > >  org.quartz.JobExecutionException: UserXQueryJob Failed: XPathException
> >  > >  in the Job: XPDY0002 : undefined context sequence for
> >  > >  'child::test.xql'! Unscheduling UserXQueryJob.
> >  > >  at org.exist.scheduler.UserXQueryJob.abort(UserXQueryJob.java:214)
> >  > >  at org.exist.scheduler.UserXQueryJob.execute(UserXQueryJob.java:199)
> >  > >  at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
> >  > >  at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
> >  > >
> >  > >  I can't go any further and I will really appreciate any help.
> >  > >
> >  > >  Regards,
> >  > >  Tom
> >  > >
> >  > >
> >  > >  Bellow is the code I am trying to run:
> >  > >  ----- run-test.xql  -----
> >  > >
> >  > >  xquery version "1.0"  encoding "UTF-8";
> >  > >
> >  > >  declare default function namespace "http://www.w3.org/2005/xpath-functions";
> >  > >  declare namespace request="http://exist-db.org/xquery/request";
> >  > >  declare namespace xdb="http://exist-db.org/xquery/xmldb";
> >  > >
> >  > >  declare boundary-space strip;
> >  > >  declare option exist:serialize "method=xml media-type=text/xml";
> >  > >
> >  > >  let $login := xmldb:login( "/db", "admin", "pass" )
> >  > >  let $sheduled := 'test.xql'
> >  > >  let $coll-path := '/db/test'
> >  > >  let $xquery-path := concat(  $coll-path, '/', $sheduled )
> >  > >
> >  > >  let $cron := '0,10,20,30,40,50 * *  * * ?'
> >  > >
> >  > >  let $mode := request:request-parameter('mode', 'check')
> >  > >  let $collection-ok := if(  not( xdb:collection-exists ( $coll-path ))  )
> >  > >           then  xdb:create-collection( '/db' ,  'test' )
> >  > >           else ()
> >  > >
> >  > >  let $result :=
> >  > >      if( $mode = 'start' )
> >  > >       then (
> >  > >           scheduler:delete-scheduled-job(  concat(   'XQuery: ',
> >  > >  $xquery-path )   ),
> >  > >           xdb:store(   $coll-path,  $sheduled,  $sheduled ),
> >  > >           scheduler:schedule-xquery-cron-job( $xquery-path,  $cron )
> >  > >       )else if( $mode = 'stop' )
> >  > >        then (
> >  > >            scheduler:delete-scheduled-job(  concat(   'XQuery: ',
> >  > >  $xquery-path )   )
> >  > >       )else ()
> >  > >
> >  > >  return
> >  > >      <result>
> >  > >            { $result }
> >  > >             { scheduler:get-scheduled-jobs()//scheduler:group[
> >  > >  @name="eXist.User" ]  }
> >  > >      </result>
> >  > >
> >  > >  ----- test.xql ------------------
> >  > >  xquery version "1.0"  encoding "UTF-8";
> >  > >
> >  > >  declare default function namespace "http://www.w3.org/2005/xpath-functions";
> >  > >  declare namespace xdb="http://exist-db.org/xquery/xmldb";
> >  > >
> >  > >  declare boundary-space strip;
> >  > >  declare option exist:serialize "method=xhtml media-type=text/html
> >  > >  omit-xml-declaration=no indent=yes";
> >  > >
> >  > >  let $login := xdb:login( "/db", "admin", "pass" )
> >  > >
> >  > >  let $log := 'log.xml'
> >  > >  let $coll-path := '/db/test'
> >  > >  let $log-path := concat(  $coll-path, '/', $log )
> >  > >
> >  > >  let $step := <test >{ current-time() }</test>
> >  > >
> >  > >  let $temp :=  update insert  $step  into doc( $log-path  )/*
> >  > >
> >  > >  return
> >  > >     <div>
> >  > >        { $step }
> >  > >    </div>
> >  > >
> >  > >  --- log.xml --
> >  > >  <root/>
> >  > >
> >  > >  -------------------------------------------------------------------------
> >  > >  This SF.net email is sponsored by: Microsoft
> >  > >  Defy all challenges. Microsoft(R) Visual Studio 2008.
> >  > >  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >  > >  _______________________________________________
> >  > >  Exist-open mailing list
> >  > >  Exist-open@...
> >  > >  https://lists.sourceforge.net/lists/listinfo/exist-open
> >  > >
> >  >
> >  >
> >  >
> >  > --
> >  > Adam Retter
> >  >
> >  > eXist Developer
> >  > { England }
> >  > adam@...
> >  > irc://irc.freenode.net/existdb
> >  >
> >
> >
> >  --
> >  Thomas White
> >
> >  51 Glebewood
> >  Bracknell
> >  Berks RG12 9SD
> >  Mobile:+44 7711 922 966
> >  Skype: thomaswhite
> >  gTalk: thomas.0007
> >  jaxtr: http://www.jaxtr.com/t.white
> >  Linked-In:http://www.linkedin.com/in/thomaswhite0007
> >
>
>
>
> --
> Adam Retter
>
> eXist Developer
> { England }
> adam@...
> irc://irc.freenode.net/existdb
>


--
Thomas White

51 Glebewood
Bracknell
Berks RG12 9SD
Mobile:+44 7711 922 966
Skype: thomaswhite
gTalk: thomas.0007
jaxtr: http://www.jaxtr.com/t.white
Linked-In:http://www.linkedin.com/in/thomaswhite0007

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: XPDY0002 :undefined context sequence for 'child::test.xql' error when I schedule a xquery file

by thomas.0007 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Adam,

I believe the real reason why I receive that error message is different.
This is the scenario:
0. The XQuery file runs manually fine.
1. I copy the XQuery files ( all reffered modules and .xsl files )
into the a collection manually (drag & drop, using WebDAV).
2. I can open the file that will be scheduled and its content is the
same as the original file.
3. After I run the scheduling code,
   scheduler:schedule-xquery-cron-job( $xquery-path,  $cron )
the content of the file is replaced with its name.
4. When the scheduler tries to execute the XQuery it fails, I guess, because the
file content is not valid XQuery text any more -  it is just the name
of the file.

Please find copy of the log files:
------ xquery file -----
the QXuery file's change timestamp is 14:40:09

--- scheduler.log ----
2008-05-15 14:40:20,015 [DefaultQuartzScheduler_Worker-1] INFO
(JobRunShell.java [run]:207) - Job eXist.User.XQuery:
/db/hpSpy/amazon/xquery/amazon-fetch-category.xql threw a
JobExecutionException:
org.quartz.JobExecutionException: UserXQueryJob Failed: XPathException
in the Job: XPDY0002 : undefined context sequence for
'child::amazon-fetch-category.xql'! Unscheduling UserXQueryJob.
        at org.exist.scheduler.UserXQueryJob.abort(UserXQueryJob.java:214)
        at org.exist.scheduler.UserXQueryJob.execute(UserXQueryJob.java:199)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)

------------ exist.log -----------
2008-05-15 14:40:09,000 [P1-6] DEBUG (Collection.java
[checkPermissions]:1293) - Found old doc 265
2008-05-15 14:40:09,000 [P1-6] DEBUG (Collection.java
[addBinaryResource]:1415) - removing old document
amazon-fetch-category.xql
2008-05-15 14:40:09,000 [P1-6] INFO  (NativeBroker.java
[removeBinaryResource]:1936) - removing binary resource 265...
2008-05-15 14:40:09,000 [P1-6] DEBUG (DOMFile.java [delete]:3507) -
removing overflow page 1217
2008-05-15 14:40:09,000 [P1-6] DEBUG (NativeBroker.java
[removeResourceMetadata]:1959) - Removing resource metadata for 265
2008-05-15 14:40:09,000 [P1-6] DEBUG (NativeBroker.java [start]:1513)
- Storing binary resource as a stream amazon-fetch-category.xql
2008-05-15 14:40:09,000 [P1-6] DEBUG (DOMFile.java [<init>]:3350) -
Creating overflow page: 1217
2008-05-15 14:40:09,015 [P1-6] DEBUG (Insert.java [eval]:131) - Found: 1 nodes
2008-05-15 14:40:11,546 [P1-6] DEBUG (NativeBroker.java
[getOrCreateCollection]:600) - Creating collection
'/db/system/temp'...
2008-05-15 14:40:11,546 [P1-6] DEBUG (DOMFile.java [add]:250) -
Creating overflow page
2008-05-15 14:40:11,546 [P1-6] DEBUG (DOMFile.java [<init>]:3350) -
Creating overflow page: 1146
2008-05-15 14:40:11,546 [P1-6] DEBUG (DOMFile.java [add]:250) -
Creating overflow page
2008-05-15 14:40:11,546 [P1-6] DEBUG (DOMFile.java [<init>]:3350) -
Creating overflow page: 1142
2008-05-15 14:40:11,546 [P1-6] DEBUG (DOMFile.java [add]:250) -
Creating overflow page
2008-05-15 14:40:11,546 [P1-6] DEBUG (DOMFile.java [<init>]:3350) -
Creating overflow page: 1138
2008-05-15 14:40:11,578 [P1-6] DEBUG (XQueryContext.java
[storeTemporaryDoc]:2133) - Stored: 262:
/db/system/temp/b6b87a6252a887efbcab0deb3ba4754e.xml
2008-05-15 14:40:11,578 [P1-6] DEBUG (XQueryContext.java
[checkOptions]:2439) - Setting serialization property from pragma:
method = xml
2008-05-15 14:40:11,578 [P1-6] DEBUG (XQueryContext.java
[checkOptions]:2439) - Setting serialization property from pragma:
media-type = text/xml
2008-05-15 14:40:11,609 [P1-6] DEBUG (XQueryContext.java
[storeTemporaryDoc]:2133) - Stored: 263:
/db/system/temp/1999fe42ef606903b28eb43b3c42ee51.xml
2008-05-15 14:40:11,625 [P1-6] DEBUG (XQueryContext.java
[storeTemporaryDoc]:2133) - Stored: 264:
/db/system/temp/3f27c738f5471443423e85dd8e979ffa.xml
2008-05-15 14:40:11,625 [P1-6] DEBUG (XQuery.java [execute]:222) -
Execution took 2,625 ms
2008-05-15 14:40:11,625 [P1-6] DEBUG (HTTPUtils.java
[addLastModifiedHeader]:61) - mostRecentDocumentTime: 0
2008-05-15 14:40:20,015 [DefaultQuartzScheduler_Worker-1] DEBUG
(XQuery.java [compile]:163) - Query diagnostics:
child::amazon-fetch-category.xql
2008-05-15 14:40:20,015 [DefaultQuartzScheduler_Worker-1] DEBUG
(XQuery.java [compile]:169) - Compilation took 0 ms
2008-05-15 14:40:25,218 [P1-4] DEBUG (WebDAV.java [process]:135) -
method='PROPFIND'; path='/db/hpSpy/amazon/xquery'; user='admin';
Lock-Token='null'; If='null'
2008-05-15 14:40:25,234 [P1-4] DEBUG (WebDAV.java [process]:160) -
Completed in 16 msecs.
2008-05-15 14:41:10,328 [P1-4] DEBUG (WebDAV.java [process]:135) -
method='PROPFIND';
path='/db/hpSpy/amazon/xquery/amazon-fetch-category.xql';
user='admin'; Lock-Token='null'; If='null'
2008-05-15 14:41:10,328 [P1-4] DEBUG (WebDAV.java [process]:160) -
Completed in 0 msecs.

I hope this new pieces of information will help ti solve the mistery.

Regards,
Tom




On 14/05/2008, Thomas White <thomas.0007@...> wrote:

> Adam,
>
> Thank you very much for your help! Not my code is working.
>
> Bellow is the a line of code that will copy xquery files  to a collection,
> from the directory where the running xquery file is located :
>
> xdb:store-files-from-pattern(  $collection-path,
> system:get-module-load-path(),  $xquery-to-copy-file-pattern,
> 'application/xquery' )
>
> Kind regards.
> Tom
>
>
> On 13/05/2008, Adam Retter <adam@...> wrote:
> > xdb:store() does not do what you think it does!
> >
> > I suspect you want something more like xdb:store($coll-path,
> > $sheduler, binary-doc(concat("/path/to/original/", $sheduled)))
> >
> > 2008/5/13 Thomas White <thomas.0007@...>:
> > > Adam,
> > >
> > >  I am new in XQuery and the I have not adopted a clear programing style jet.
> > >  May be that is why it is not obvious what I am doing.
> > >
> > >
> > >  xdb:store(   $coll-path,  $sheduled,  $sheduled )
> > >  copies a fresh copy of the test.xql file from the current directory
> > >  into /db/test collection as /db/test/test.xql .
> > >
> > >  This line in /db/test/test.xql
> > >
> > >       let $temp :=  update insert  $step  into doc( $log-path  )/*
> > >  stores a line into /db/test/log.xml every time when /db/test/test.xql
> > >  is executed.
> > >  When I execute test.xql manually it works.
> > >
> > >  I hope now is clear what I am trying to achieve.
> > >
> > >  Regards,
> > >  Tom
> > >
> > >
> > >
> > >
> > >
> > >
> > >  On 13/05/2008, Adam Retter <adam@...> wrote:
> > >  > Hmm this doesnt make too much sense in places!
> > >  >
> > >  > Particularly this line -  xdb:store(   $coll-path,  $sheduled,  $sheduled ),
> > >  >
> > >  > I understand you have a control script and you want to store an xquery
> > >  > into the database, however in the query you posted you never store the
> > >  > data of the xquery into the db. The above stores the file
> > >  > /db/test/test.xql with the content "test.xql" ?!?
> > >  >
> > >  >
> > >  >
> > >  > 2008/5/13 Thomas White <thomas.0007@...>:
> > >  > > I have been trying run a scheduled xquery but I receive the following
> > >  > >  an error (in the scheduler.log) :
> > >  > >  2008-05-13 12:52:00,015 [DefaultQuartzScheduler_Worker-4] INFO
> > >  > >  (JobRunShell.java [run]:207) - Job eXist.User.XQuery:
> > >  > >  /db/test/test.xql threw a JobExecutionException:
> > >  > >  org.quartz.JobExecutionException: UserXQueryJob Failed: XPathException
> > >  > >  in the Job: XPDY0002 : undefined context sequence for
> > >  > >  'child::test.xql'! Unscheduling UserXQueryJob.
> > >  > >  at org.exist.scheduler.UserXQueryJob.abort(UserXQueryJob.java:214)
> > >  > >  at org.exist.scheduler.UserXQueryJob.execute(UserXQueryJob.java:199)
> > >  > >  at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
> > >  > >  at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
> > >  > >
> > >  > >  I can't go any further and I will really appreciate any help.
> > >  > >
> > >  > >  Regards,
> > >  > >  Tom
> > >  > >
> > >  > >
> > >  > >  Bellow is the code I am trying to run:
> > >  > >  ----- run-test.xql  -----
> > >  > >
> > >  > >  xquery version "1.0"  encoding "UTF-8";
> > >  > >
> > >  > >  declare default function namespace "http://www.w3.org/2005/xpath-functions";
> > >  > >  declare namespace request="http://exist-db.org/xquery/request";
> > >  > >  declare namespace xdb="http://exist-db.org/xquery/xmldb";
> > >  > >
> > >  > >  declare boundary-space strip;
> > >  > >  declare option exist:serialize "method=xml media-type=text/xml";
> > >  > >
> > >  > >  let $login := xmldb:login( "/db", "admin", "pass" )
> > >  > >  let $sheduled := 'test.xql'
> > >  > >  let $coll-path := '/db/test'
> > >  > >  let $xquery-path := concat(  $coll-path, '/', $sheduled )
> > >  > >
> > >  > >  let $cron := '0,10,20,30,40,50 * *  * * ?'
> > >  > >
> > >  > >  let $mode := request:request-parameter('mode', 'check')
> > >  > >  let $collection-ok := if(  not( xdb:collection-exists ( $coll-path ))  )
> > >  > >           then  xdb:create-collection( '/db' ,  'test' )
> > >  > >           else ()
> > >  > >
> > >  > >  let $result :=
> > >  > >      if( $mode = 'start' )
> > >  > >       then (
> > >  > >           scheduler:delete-scheduled-job(  concat(   'XQuery: ',
> > >  > >  $xquery-path )   ),
> > >  > >           xdb:store(   $coll-path,  $sheduled,  $sheduled ),
> > >  > >           scheduler:schedule-xquery-cron-job( $xquery-path,  $cron )
> > >  > >       )else if( $mode = 'stop' )
> > >  > >        then (
> > >  > >            scheduler:delete-scheduled-job(  concat(   'XQuery: ',
> > >  > >  $xquery-path )   )
> > >  > >       )else ()
> > >  > >
> > >  > >  return
> > >  > >      <result>
> > >  > >            { $result }
> > >  > >             { scheduler:get-scheduled-jobs()//scheduler:group[
> > >  > >  @name="eXist.User" ]  }
> > >  > >      </result>
> > >  > >
> > >  > >  ----- test.xql ------------------
> > >  > >  xquery version "1.0"  encoding "UTF-8";
> > >  > >
> > >  > >  declare default function namespace "http://www.w3.org/2005/xpath-functions";
> > >  > >  declare namespace xdb="http://exist-db.org/xquery/xmldb";
> > >  > >
> > >  > >  declare boundary-space strip;
> > >  > >  declare option exist:serialize "method=xhtml media-type=text/html
> > >  > >  omit-xml-declaration=no indent=yes";
> > >  > >
> > >  > >  let $login := xdb:login( "/db", "admin", "pass" )
> > >  > >
> > >  > >  let $log := 'log.xml'
> > >  > >  let $coll-path := '/db/test'
> > >  > >  let $log-path := concat(  $coll-path, '/', $log )
> > >  > >
> > >  > >  let $step := <test >{ current-time() }</test>
> > >  > >
> > >  > >  let $temp :=  update insert  $step  into doc( $log-path  )/*
> > >  > >
> > >  > >  return
> > >  > >     <div>
> > >  > >        { $step }
> > >  > >    </div>
> > >  > >
> > >  > >  --- log.xml --
> > >  > >  <root/>
> > >  > >
> > >  > >  -------------------------------------------------------------------------
> > >  > >  This SF.net email is sponsored by: Microsoft
> > >  > >  Defy all challenges. Microsoft(R) Visual Studio 2008.
> > >  > >  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > >  > >  _______________________________________________
> > >  > >  Exist-open mailing list
> > >  > >  Exist-open@...
> > >  > >  https://lists.sourceforge.net/lists/listinfo/exist-open
> > >  > >
> > >  >
> > >  >
> > >  >
> > >  > --
> > >  > Adam Retter
> > >  >
> > >  > eXist Developer
> > >  > { England }
> > >  > adam@...
> > >  > irc://irc.freenode.net/existdb
> > >  >
> > >
> > >
> > >  --
> > >  Thomas White
> > >
> > >  51 Glebewood
> > >  Bracknell
> > >  Berks RG12 9SD
> > >  Mobile:+44 7711 922 966
> > >  Skype: thomaswhite
> > >  gTalk: thomas.0007
> > >  jaxtr: http://www.jaxtr.com/t.white
> > >  Linked-In:http://www.linkedin.com/in/thomaswhite0007
> > >
> >
> >
> >
> > --
> > Adam Retter
> >
> > eXist Developer
> > { England }
> > adam@...
> > irc://irc.freenode.net/existdb
> >
>
>
> --
> Thomas White
>
> 51 Glebewood
> Bracknell
> Berks RG12 9SD
> Mobile:+44 7711 922 966
> Skype: thomaswhite
> gTalk: thomas.0007
> jaxtr: http://www.jaxtr.com/t.white
> Linked-In:http://www.linkedin.com/in/thomaswhite0007
>


--
Thomas White

51 Glebewood
Bracknell
Berks RG12 9SD
Mobile:+44 7711 922 966
Skype: thomaswhite
gTalk: thomas.0007
jaxtr: http://www.jaxtr.com/t.white
Linked-In:http://www.linkedin.com/in/thomaswhite0007

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open