Christian,

One option. Suppose we have an xml doc that contains same elements inside like
<a>
  <b> ..</b>
  <b>.. </b>
  ...
</a>

We can partition all b'b blocks inside clojure and call clojure functions that will work parallel seamless way. Each clojure function will call xquery through basex' java bridge to process its xml block.
Clojure will collect results of all parallel functions and write into disk or call other xquery functions.

Or Clojure call basex to partition xml file and return back parts. Clojure will then call parallel functions with parts

In this way, whenever we need xml processing, clojure will call basex. All threading will be supported by clojure.

Erol Akarsu








On Thu, Oct 24, 2013 at 6:49 PM, Christian Grün <cg@basex.org> wrote:
> For example, I have big load of urls to crawl. Urls can be split to multiple
> chunks. Basex can start multiple function calls in parallel that deals one
> chunk.
> After functions finished, we can merge results. This is basic way.

Haskell provides the Strategies library for that:

  http://hackage.haskell.org/package/parallel-3.1.0.1/docs/Control-Parallel-Strategies.html

It would be rather easy to implement some first quick hacks that
provide simple multi-threading, but it gets a real challenge if you
want to make the feature production safe. This is different for
languages like Clojure, because parallel programming is at the very
core of the language.