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

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 in Thread

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

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

LightInTheBox - Buy quality products at wholesale price