xquerymarklogic-8marklogic-corb

Not able to get XML file via MarkLogic Corb Tool


I want to get xml input file via the MarkLogic CoRB Tool to proceed further, but not able to get this file via CoRB tool:

ML config Properties file:

    THREAD-COUNT=16
    MODULE-ROOT=/
    MODULES-DATABASE=.\\37074\\XQuery\\PROD-MetadataModules
    XML-FILE=.\\37074\\input\\asme_module_v3.xml
    XML-NODE=rdf:RDF
    PROCESS-MODULE=.\\37074\\XQuery\\upload-skos-file.xqy|ADHOC
    EXPORT-FILE-DIR=.\\37074\\Report
    EXPORT-FILE-NAME=update-Non-member-price-report.xml
    EXPORT-FILE-TOP-CONTENT="Record"
    URIS-LOADER=com.marklogic.developer.corb.FileUrisXMLLoader
    PROCESS-TASK=com.marklogic.developer.corb.ExportBatchToFileTask
    DECRYPTER=com.marklogic.developer.corb.JasyptDecrypter

XML Input file('asme_module_v3.xml'), that I want to get through 'upload-skos-file.xqy' via MarkLogic Corb Tool :

    <?xml version="1.0" encoding="UTF-8"?>
    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#">
    <skos:ConceptScheme rdf:about="http://www.bsigroup.com/asme/">
    <skos:hasTopConcept rdf:resource="http://www.bsigroup.com/asme/A112"/>
    <skos:hasTopConcept rdf:resource="http://www.bsigroup.com/asme/A120"/>
    </skos:ConceptScheme>
    </rdf:RDF>

Code in 'upload-skos-file.xqy' file:

    xquery version "1.0-ml";
    declare variable $URI external;
    let $skos-number := $URI
    let $_           := xdmp:log("=========================skos-number===========================")
    return xdmp:log($skos-number)

The MarkLogic corb tool executes successfully but not get any entry in the Marklogic Log file, I'm not sure where did a mistake there.


Solution

  • The CoRB StreamingXPath is not currently able to register and leverage namespaces and namespace-prefixes, so the XPath targeting namespace-qualified elements can't leverage namespace-prefixes.

    A more generic match on the document element with a predicate filtering by local-name() will work though. It's a little ugly and a lot more typing, but works:

    XML-NODE=*[local-name()='RDF' and namespace-uri()='http://www.w3.org/1999/02/22-rdf-syntax-ns#']
    

    Or if RDF local-name() is good enough:

    XML-NODE=*[local-name()='RDF']