MARKLOGIC:在MarkLogic中提取数据期间生成URI ID时,是否可以在CSV文件中使用超过1列? [英] MARKLOGIC: Is it possible to use more than 1 columns from a CSV file when generating URI ID during data ingestion in MarkLogic?

查看:86
本文介绍了MARKLOGIC:在MarkLogic中提取数据期间生成URI ID时,是否可以在CSV文件中使用超过1列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对MarkLogic还是很陌生,我不确定如何最好地应对目前遇到的挑战.

I am quite new to MarkLogic and I am not sure how to best deal with the challenge I have right now.

我有一个从表中导出的CSV文件,该文件将被提取到MarkLogic数据库中.现在,源表使用4列作为其唯一的主键组合.

I have a CSV file exported from a table that will be ingested to MarkLogic database. Now the source table uses 4 columns as its unique primary key combination.

在MarkLogic中,默认情况下,CSV文件中只有一列可用作URI ID.

In MarkLogic, by default, only one column from CSV file can be used as the URI ID.

我的问题是,在MarkLogic中提取数据期间,是否可以将CSV文件中的多于1列用作URI ID? 如果是,此功能或设置在数据中心中可用吗? 如果不可能的话,在MarkLogic中通常最好的做法是什么?

My question is, is it possible to use more than 1 columns from a CSV file as the URI ID during data ingestion in MarkLogic? If yes, is this feature or setting available in data hub? If it is not possible, what is usually the best practice for this in MarkLogic?

我知道一种可能的解决方法是创建一个新列,合并来自4个主键列的数据并将其用作URI ID.

I know that one possible work around is to create a new column combining the data from 4 primary key columns and use it as the URI ID.

非常感谢您的帮助:)

推荐答案

您可以使用 MLCP转换可同时转换内容值和uri.它获取包含两者的哈希对象$ content.根据需要更新其值,并返回更新的哈希对象.像这样:

You can use MLCP Transforms to transform both the content value, and the uri. It gets a hash object $content containing both. Update its values as desired, and return the updated hash object. Something like:

declare function example:transform(
  $content as map:map,
  $context as map:map
) as map:map*
{
  let $record := map:get($content, "value")
  let $uri := $record/prop1 || $record/prop2 || $record/prop3 
  let $_ := map:put($content, "uri", $uri)
  return $content
};

您也可以在marklogic-data-hub中使用这种MLCP转换.

You can use such MLCP transforms in marklogic-data-hub as well.

HTH!

这篇关于MARKLOGIC:在MarkLogic中提取数据期间生成URI ID时,是否可以在CSV文件中使用超过1列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆