Hi, I am creating an action to reload a XML dump of my eXist database and that raises several questions showing that the behaviour of the pipes called from an action isn't as straightforward as I had thought.
The bizdoc example shows several cases of such pipes without output that lead to database operations and the database processors seem to act as sinks that pull the input of pipes even when they don't have any output, such as in: <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"> <p:param name="document-id" type="input" schema-href="../document-id.rng"/> <p:processor name="oxf:xslt"> <p:input name="data" href="#document-id"/> <p:input name="config"> <xdb:delete xsl:version="2.0" collection="/db/orbeon/bizdoc-example" xmlns:xdb="http://orbeon.org/oxf/xml/xmldb"> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">/document-info[document-id = '</xsl:text> <xsl:value-of select="." xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform">']</xsl:text> </xdb:delete> </p:input> <p:output name="data" id="query"/> </p:processor> <p:processor name="oxf:xmldb-delete"> <p:input name="datasource" href="datasource.xml"/> <p:input name="query" href="#query"/> </p:processor> </p:config> That's not the case of other processors and if you write an action such as: <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xdb="http://orbeon.org/oxf/xml/xmldb" xmlns:bk="http://apiculteurs.info/namespace/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <p:param name="instance" type="input"/> <p:processor name="oxf:identity"> <p:input name="data" href="#instance" debug="instance"/> <p:output name="data" id="unused"/> </p:processor> </p:config> the identity processor is never executed. That's logical and the result of a good optimisation since the output of the identity processor is never used. Is the difference of behaviour only because the oxf:xmldb-delete has no output while the oxf:identity processor is it a special property of the oxf:xmldb-delete processor to act as a sink? My database dumps are RDF documents in which I'd like to split each top level element in a separate document in the eXist database (embedded in its own rdf root element to make it snippet a valid RDF document). The p:for-each loop seems to be the right tool to do so. Unfortunately, the for-each has a mandatory output that I need to declare even if the branches of the for-each are oxf:xmldb-insert that have no output. As a result of that, the for-each loop isn't considered as a sink and isn't executed when the action is called. The workaround I have found for that is to create a fake result that I remove with an XPointer expression before generating the output: <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xdb="http://orbeon.org/oxf/xml/xmldb" xmlns:bk="http://apiculteurs.info/namespace/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <p:param name="instance" type="input"/> <p:param name="data" type="output"/> <p:processor name="oxf:pipeline"> <p:input name="config" href="read-uri.xpl"/> <p:input name="uri" href="aggregate('uri', #instance#xpointer(string(/form/files/file)))" debug="uri"/> <p:output name="data" id="document" debug="upload"/> </p:processor> <p:for-each href="#document" select="/rdf:RDF/*" root="unused" id="unused"> <p:processor name="oxf:xmldb-insert"> <p:input name="datasource" href="data-access/exist/datasource.xml"/> <p:input name="query"> <xdb:insert collection="/db/apiculteurs/apiculteurs"/> </p:input> <p:input name="data" href="aggregate('rdf:RDF', current())" debug="individualFile"/> </p:processor> <p:processor name="oxf:identity"> <p:input name="data" href="current()"/> <p:output name="data" ref="unused"/> </p:processor> </p:for-each> <p:processor name="oxf:identity"> <p:input name="data" href="aggregate('foo', #instance, #unused)"/> <p:output name="data" id="hack"/> </p:processor> <p:processor name="oxf:identity"> <p:input name="data" href="#hack#xpointer(/foo/form)"/> <p:output name="data" ref="data"/> </p:processor> </p:config> That's working, but this is neither elegant, readable nor (probably) efficient. Is there a simpler way of doing that? Would it solve the problem if the id attribute of p:for-each was made optional and the for-each considered as a sink when the attribute missing? Thanks, Eric -- Freelance consulting and training. http://dyomedea.com/english/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ orbeon-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/orbeon-user
