首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无效TDE模板

无效TDE模板
EN

Stack Overflow用户
提问于 2022-06-02 09:36:23
回答 1查看 33关注 0票数 1

我的MarkLogic数据库由“专利”文件夹中的几个示例文档组成:

  • /专利/无气分配
  • /专利/smart_racket.json
  • /专利/调谐_ukulele.json
  • /专利/waterski_drone.json

每一份文件都是这样的:

代码语言:javascript
复制
{
  "patent": {
    "title": "Airless SCUBA diving", 
    "inventor": "Greg", 
    "description": "Diving pill that provides airless SCUBA diving for up to 1 hour"
  }
}

我正在尝试创建一个模板:

代码语言:javascript
复制
    const tde = require ('/MarkLogic/tde');
    
    const inventionsTemplate = xdmp.toJSON(
    {
      'template':{
        'context':'patent',
        'directories':["patents", "another_patents"],
        'rows':[
        {
          'viewName':'inventions',
          'columns':[
          {
            'name':'title',
            'scalarType':'string',
            'val':'../title',
            'nullable':true
          },
          {
            'name':'inventor',
            'scalarType':'string',
            'val':'../inventor',
            'nullable':true
          },
          {
            'name':'description',
            'scalarType':'string',
            'val':'../description',
            'nullable':true
          }
          ]
        }]
      }
    }
    );

tde.templateInsert('/templates/inventionsTemplate.json', inventionsTemplate);

但是得到了一个错误:

(err:err 0000) tde.templateInsert('/templates/inventionsTemplate.json',inventionsTemplate);-无效TDE模板: TDE-INVALIDTEMPLATENODE:无效提取模板节点: fn:doc("")/template/array-node("rows")/object-node()

第75行第6列的堆栈跟踪:在tde.templateInsert('/templates/inventionsTemplate.json',inventionsTemplate中);

fn:QName("http://marklogic.com/xdmp/tde","templateURI") =“/http://marklogic.com/xdmp/tde","templateURI"/inventionsTemplate.json”fn:QName(“http://marklogic.com/xdmp/tde","template"”=“http://marklogic.com/xdmp/tde","templateURI"”目录“):数组-节点{.},} fn:QName("http://marklogic.com/xdmp/tde","permissions") = () fn:QName("http://marklogic.com/xdmp/tde","collections") = () fn:QName(“http://marklogic.com/xdmp/tde","testvalid"”)=map(http://www.w3.org/2001/XMLSchema“xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance”./>)fn:QName(“http://marklogic.com/xdmp/tde","permarray"”)= json:array() fn:QName(“http://marklogic.com/xdmp/tde","colsarray"”)=json:xmlns:xsi=()

在我的例子中,创建MarkLogic模板驱动提取的正确语法是什么?插入TDE之前,我是否遗漏了一些准备步骤?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-02 12:11:32

您的缺少一个schemaName属性。

如果将它添加到rows数组中的对象中,它将验证和插入。

代码语言:javascript
复制
'rows':[
    {
      'schemaName':'patents',
      'viewName':'inventions',
      'columns':[

文档可能会得到改进,以指示哪些属性(如schemaNameviewName )是必需的,哪些属性是可选的,例如view-layout

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72473991

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档