我对exide和exide相当陌生,所以我已经习惯了gui和菜单,以及做东西的方式。我的问题是,我已经有一个项目,一个老师从他的存在下载它,并把它作为一个.rar给我。
问题是,我想要导入该项目,使其保持与其所拥有的文件夹结构相同。我尝试通过“集合”菜单导入它,但它忽略了文件夹结构,只上传了一个文件夹中的所有文件
文件夹结构如下:
final:
-db
-contrib
-file
-file
-css
-somecss
-somecss
-js
-somejs
-somejs
-img
-img1.png
-xqueryelement.xq
-xqueryelement2.xq
-htmlelement.html发布于 2014-03-21 12:05:00
如果提取出.rar文件,并且每个文件夹都包含"_ contents_ _.xml",那么您可以使用来自java客户端的恢复功能。
如果没有,则可以使用以下内容。(我还没有对代码进行测试,而是实时编写的。)从仪表板上启动eXide。以管理员身份登录,然后将下面的代码复制到ide中,然后运行它。
该代码具有从Priscilla Walmsley的FUNCTX函数模块中复制的一些函数。http://www.xqueryfunctions.com/
xquery version "3.0";
declare namespace file="http://exist-db.org/xquery/file";
(:~
: Escapes regex special characters
:
: @author Priscilla Walmsley, Datypic
: @version 1.0
: @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html
: @param $arg the string to escape
:)
declare function local:escape-for-regex( $arg as xs:string? ) as xs:string {
replace($arg, '(\.|\[|\]|\\|\||\-|\^|\$|\?|\*|\+|\{|\}|\(|\))','\\$1')
} ;
(:~
: The substring before the last occurrence of a delimiter
:
: @author Priscilla Walmsley, Datypic
: @version 1.0
: @see http://www.xqueryfunctions.com/xq/functx_substring-before-last.html
: @param $arg the string to substring
: @param $delim the delimiter
:)
declare function local:substring-before-last( $arg as xs:string?, $delim as xs:string ) as xs:string {
if (matches($arg, local:escape-for-regex($delim)))
then replace($arg,
concat('^(.*)', local:escape-for-regex($delim),'.*'),
'$1')
else ''
} ;
(:~
: The substring after the last occurrence of a delimiter
:
: @author Priscilla Walmsley, Datypic
: @version 1.0
: @see http://www.xqueryfunctions.com/xq/functx_substring-after-last.html
: @param $arg the string to substring
: @param $delim the delimiter
:)
declare function local:substring-after-last
( $arg as xs:string? ,
$delim as xs:string ) as xs:string {
replace ($arg,concat('^.*',local:escape-for-regex($delim)),'')
} ;
declare function local:import($base as xs:string, $path as xs:string) {
let $offset := fn:substring-after($path, $base)
return
if (file:is-directory($path))
then
let $created := xmldb:create-collection('/', '/')
let $coll := for $resource in file:list($path)
return local:import($base, $path || '/' || $resource)
return $path
else
let $collection : = local:substring-before-last($offset, '/')
let $resource : = local:substring-after-last($offset, '/')
let $stored := xmldb:store($collection, $resource,
file:read-binary($path), 'application/octet-stream')
let $permission := if (fn:ends-with($resource, ".xq"))
then sm:chmod($collection || '/' || $resource, 'rwxr-xr-x')
else ()
return $path
};
let $base := '/tmp/lctmp'
let $path := '/tmp/lctmp/db'
return local:import($base, $path)发布于 2014-03-21 13:40:03
除了Ron和Loren建议的方法之外,您还可以使用一个WebDAV客户机--可能是最简单的。或者您可以使用eXide函数编写查询(例如,在xmldb:store-files-from-pattern()中)。在本文将数据输入eXist-db中提到了上述所有内容。
如果您对使用xmldb:store-files-from-pattern()函数感兴趣,以下是具体的说明。您将使用带有$preserve-structure参数的函数的变体。函数的这个变体的函数文档的直接链接是http://exist-db.org/exist/apps/fundocs/view.html?uri=http://exist-db.org/xquery/xmldb#store-files-from-pattern.5。以下是一些步骤:
http://localhost:8080/exist/apps/eXide )。以管理员用户的身份登录,以便您的查询能够写入数据库。发布于 2014-03-21 11:27:06
要在eXist中上载文件夹结构,您有两个选项:
http://localhost:8080/exist/webstart/exist.jnlp,或者通过http://localhost:8080/exist/apps/dashboard/index.html仪表板上的链接访问它;或者通过快速启动按钮中的弹出菜单访问它(如果在Windows上,则右下角的快速启动工具栏)。在那里,您可以添加整个文件夹。希望这能帮上忙
罗恩
https://stackoverflow.com/questions/22550974
复制相似问题