Christian Grün wrote:
Hi,
Personally, I'm too poorly informed to assess how much time would have to be spent in the extension, so any community feedback on this is more than welcome.
I guess a proof-of-concept, ad-hoc extension can be written in one day, or even less. But having an industry-ready one is another kind of beast (writing tests, designing the interface, thinking about install and deployment, etc.)
For what is worth noting, here is what I am using for now. An XSLT step is generating the XQuery (as a mix of text and element nodes). This is then escaped to serialize elements, then saved to the filesystem, then passed to BaseX (assuming a script called 'basex' is in the PATH):
<p:xslt name="compile"> ... </p:xslt>
<p:escape-markup name="escape"/>
<p:store method="text"> <p:with-option name="href" select="$compiled-file"/> </p:store>
<p:exec command="basex" name="run"> <p:with-option name="args" select="$compiled-file"/> <p:input port="source"> <p:empty/> </p:input> </p:exec>
If you don't want to impose a script 'basex' to be in the PATH, you can call Java directly:
<p:exec command="java" name="run"> <p:with-option name="args" select=" string-join( ('-cp', $basex-jar, 'org.basex.BaseX', $compiled-file), ' ')"/> <p:input port="source"> <p:empty/> </p:input> </p:exec>
But you then need to get the path to the BaseX JAR somehow. E.g. passing it as an option to the pipeline:
<p:pipeline ...> <p:option name="basex-jar" required="true"/>
Both methods have the same problem: they have to save the query on the filesystem. It would be yet a huge improvement to be able to pass the query some way without saving it on disk. Which I guess would be fairly easy in an extension step in Java, for someone who knows the BaseX API ;-)
But the real challenge is probably more to design a clean and usable interface (especially dealing with the differences between the standalone processor, the server, the client, etc.)
For info, see the XSpec test harness I am writing for BaseX in attachement.
Hope that helps, regards,
-- Florent Georges http://fgeorges.org/ http://h2oconsulting.be/