Hello Mary Holstege, Thank you very much for your clarifications. It is a quite important piece of information that the extension of the document within the ML database has important meaning attached to it.
Best regards, Max On Tue, Sep 20, 2016 at 4:55 PM, Mary Holstege <mary.holst...@marklogic.com> wrote: > On Tue, 20 Sep 2016 05:06:54 -0700, Max-Gerd Retzlaff > <max-gerd.retzl...@lambdawerk.com> wrote: > >> Hi, >> >> We stumbled upon occasional "hiccups" when updating modules in module >> databases, and have the suspicion that this might be related to the >> module caching, and the use of the file extension "xqm" (for XQuery >> Module, as developed by The W3C XML Query Working Group). >> >> In the section "Module Caching Notes"[2] of "Importing XQuery Modules, >> XSLT Stylesheets, and Resolving Paths" the explanations do not refer >> to the format of the document (or rather, module) but always use odd >> phrases such as: >> - "file extension for a module corresponding to >> application/vnd.marklogic-xdmp or application/xslt+xml mimetypes", >> - "mimetype extension corresponding to application/vnd.marklogic-xdmp >> or application/xslt+xml", >> - "a module that does not have the correct extension", and so on. >> Also that section suggests to "add other extensions to these mimetypes >> using the mimetypes configuration in the Admin Interface" to avoid >> problems with the (automatic) module caching. >> >> This gives us the impression, that for the module caching the >> document's MIME type is actually not obeyed, but that this part always >> relies on the fact that the file extensions should match entries in >> the "mimetypes configuration". > > The thing to know is that the document's MIME type within the server is > determined from the file extensions and the MIME type configuration in the > server. Any MIME type header you send in to begin with is only used to > determine an initial default format, but that is immediately lost and what > really matters is the configured MIME type mapping. > >> >> Is this assumption / interpretation correct? >> >> Also, from our tests we deduct that MarkLogic actually doesn't store >> the MIME type (but just uses it to map to a document format (i.e., >> xml, text, binary, or json)). > > It is not stored, correct. It is used to determine the default document > format, also correct. (The default could be overridden depending on how > you load it.) So when it comes to the deeper levels where caching > behaviour is determined, what matters is the configured mapping, not any > MIME type header that may have been sent at one time. This configured MIME > type is used to determine appropriate caching behaviour. > >> >> The core question is: how do we ensure that the cache works as >> expected. Is it best practice to specify MIME types (when uploading >> using the REST interface), or does the file extension (together with >> the "mimetypes configuration") take precedence over the explicit MIME >> type. > > The file extension 'xqm' is not pre-configured to be mapped to anything in > MarkLogic server (xqy, xq, xqe, or xquery are pre-configured). Your best > practice, if you use non-default file extensions for XQuery modules, is to > add a mapping in the server's MIME type configuration so that the server > knows what MIME type a document is. The extension should be mapped to > 'application/vnd.marklogic-xdmp' for caching to work properly as an XQuery > module. > > //Mary _______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general