我需要将 xquery 模块上传并使用到 marklogic 6,例如 check-docAvailable.xqy。我尝试使用 ML6 给出的 dictionary.xqy 示例,它运行良好。但是当我尝试导入我自己的 xquery 时,我遇到了以下错误。
ERROR :
Exception in thread "main" com.marklogic.client.FailedRequestException: Local message: config/resources write failed: Internal Server Error. Server Message: XDMP-IMPORTMOD: Cannot import Main Module /marklogic.rest.resource/dictionary/lib/resource.xqy. See the MarkLogic server error log for further detail.
at com.marklogic.client.impl.JerseyServices.putPostValueImpl(JerseyServices.java:2033)
at com.marklogic.client.impl.JerseyServices.putValue(JerseyServices.java:1918)
at com.marklogic.client.impl.ResourceExtensionsImpl.writeServices(ResourceExtensionsImpl.java:114)
at com.mobius.ln.ml.util.MLUtil$DictionaryManager.installResourceExtensionShortcut(MLUtil.java:279)
at com.mobius.ln.ml.util.MLUtil.main(MLUtil.java:202)
我的 Xquery 模块:
xquery version "1.0-ml";
declare namespace xs = "http://www.w3.org/2001/XMLSchema";
declare variable $uri as xs:string external;
let $uri := $uri
return (
fn:doc-available($uri)
)
请建议我如何实现这一点。 Xquery有没有错误?
最佳答案
我建议通读 Extending the REST API .您的 XQuery 模块看起来不像 REST 扩展。当我尝试通过 curl 安装你的模块时
curl --anyauth --user admin:admin -i \
-H "Content-type: application/xquery" \
--data-binary @/c/temp/a.xqy \
-X PUT http://localhost:8000/LATEST/config/resources/a
我收到以下错误:
{"errorResponse":{"statusCode":400, "status":"Bad Request", "messageCode":"RESTAPI-INVALIDCONTENT", "message":"RESTAPI-INVALIDCONTENT: (err:FOER0000) 无效内容:无效的扩展:无法解析 XQuery 扩展 a;请参阅服务器错误日志了解详细信息或不在 http://marklogic.com/rest-api/resource/a 命名空间中提供扩展功能(删除、获取、放置、发布)"}}
关于java - Marklogic 6 , java调用资源扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36428569/