我想在加载文件时动态添加原始目录名称作为集合。
假设有以下文件:/home/sampledata/dir1/targetfile.xml 我希望 targetfile.xml 包含在以下集合中:“home”、“sampledata”、“dir1”
我们可以在通过 MLCP 导入时执行此操作吗?或者如果有人可以分享通过脚本实现的替代方法,我们将不胜感激。
您可以使用此查询:
let $dir-seprator := "/"
for $uri in cts:uri-match("*")[fn:ends-with(.,'.xml')][1 to 10]
let $collection := fn:substring-before($uri,fn:tokenize($uri,$dir-seprator)[fn:last()])
return
xdmp:document-set-collections($uri,fn:tokenize($collection,$dir-seprator)[.!='']))
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句