Thank you, Christian, for the detailed explanation!

One more question, if I may. Is it possible to run updating jobs on
different databases in parallel? Or can database update operations only be
run sequentially, one db at a time? I have a query that calls a function to
perform a series of operations:

for $i in (0 to 9)
return (
  jobs:eval('
    declare variable $iter external;
    local:add-uris("marc.exp.20210115."||$iter)
  ', map {"iter": $i})
)

The function:

   - opens a database
   - iterates through its records
   - performs lookups against an index
   - inserts any matches into the database
   - calls file:append-text-lines() to write the results of the lookups

Based on some simple tests, it doesn't seem possible to run the jobs in
parallel, but I thought I would ask--to see whether there was something I
was missing.

Thanks again,
Tim


--
Tim A. Thompson
Discovery Metadata Librarian
Yale University Library

On Sat, Feb 6, 2021 at 5:22 PM Christian Grün <christian.gr...@gmail.com>
wrote:

> Hi Tim,
>
> file:write uses the default W3 serialization method "XML". This means
> that the standard entities (&, <, etc.) will be encoded. This can be
> circumvented by using the 'text' output method…
>
>   file:write(..., ..., map { 'method': 'text' })
>
> …or file:write-text.
>
> In BaseX, we introduced our own serialization method 'basex', which
> serializes strings as strings and basex64 and hex data as bytes. With
> this method (if it had been part of the official standard),
> file:write-text and file:write-binary could actually have been
> dropped.
>
> > Ah, never mind. When I run the file:write-text() without jobs:eval(), I
> get an error, "Cannot convert xs:dateTime to xs:string." Is it possible to
> return the error from a job call?
>
> You can cache the result of a query…
>
>   let $job-id := jobs:eval(..., ..., map { 'cache': true() })
>
> …and retrieve the result or the error with jobs:result($job-id).
>
> Hope this helps,
> Christian
>

Reply via email to