What are in memory elements in marklogic?

二次信任 提交于 2019-12-01 17:19:07

Anything constructed within a query is an in-memory element. For example this XQuery yields an in-memory element:

<test/>

Some function calls also return in-memory elements: xdmp:unquote is an obvious example. Any node that doesn't come from the current database will be treated as an in-memory node.

This query yields a database element (if it exists), which could be modified using xdmp:node-replace:

doc('fubar')/test

This is a typical in-memory update error:

xdmp:node-replace(<x/>, <y/>)

With MarkLogic 6.0-1.1, the error code is XDMP-UPCONSTNODES.

If you want to update in-memory nodes as if they were in the database by using similar function calls, there's a utility library that does that:

https://github.com/marklogic/commons/tree/master/memupdate

The main library also ships with MarkLogic Server under App Services:

appservices/utils/in-mem-update.xqy

If your working with in memory elements import the following module

import module namespace mem = "http://xqdev.com/in-mem-update" at "/MarkLogic/appservices/utils/in-mem-update.xqy";

Instead of using xdmp:node-replace you can use mem:node-replace(<x/>, <y/>)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!