我正在使用 TDE(模板驱动提取)。我有一个实体并试图获取重复字段(无结果)和 valueMap 的数据(在一行中返回结果。)
<?xml version="1.0" encoding="UTF-8"?>
<entity>
<status>Active</status>
<instanceName>Instance1</instanceName>
<entityName>Entity1</entityName>
<entityfields>
<entityfield>
<entityfieldName>StringData</entityfieldName>
<entityfieldType>string</entityfieldType>
<stringValue>vikram</stringValue>
<valueMap>
</valueMap>
</entityfield>
<entityfield>
<entityfieldName>ListData</entityfieldName>
<entityfieldType>list</entityfieldType>
<listValue>V1</listValue>
<listValue>V2</listValue>
<valueMap>
</valueMap>
</entityfield>
<entityfield>
<entityfieldName>TwoValListData</entityfieldName>
<entityfieldType>twoValueList</entityfieldType>
<valueMap>
<entry>
<key>F1V1</key>
<value>F2V1</value>
</entry>
<entry>
<key>F1V2</key>
<value>F2V2</value>
</entry>
</valueMap>
</entityfield>
</entityfields>
</entity>
TDE 模板
xquery version "1.0-ml";
import module namespace tde = "http://marklogic.com/xdmp/tde"
at "/MarkLogic/tde.xqy";
let $Entity_View :=
<template xmlns="http://marklogic.com/xdmp/tde">
<context>/entity/entityfields/entityfield</context>
<collections>
<collections-and>
<collection>entityinstance</collection>
<collection>Entity1</collection>
</collections-and>
</collections>
<rows>
<row>
<schema-name>main</schema-name>
<view-name>entityView</view-name>
<view-layout>sparse</view-layout>
<columns>
<column>
<name>instanceName</name>
<scalar-type>string</scalar-type>
<val>../../instanceName</val>
</column>
<column>
<name>status</name>
<scalar-type>string</scalar-type>
<val>../../status</val>
</column>
<column>
<name>entityfieldName</name>
<scalar-type>string</scalar-type>
<val>entityfieldName</val>
</column>
<column>
<name>entityfieldType</name>
<scalar-type>string</scalar-type>
<val>entityfieldType</val>
</column>
<column>
<name>stringValue</name>
<scalar-type>string</scalar-type>
<val>stringValue</val>
<nullable>true</nullable>
<default>""</default>
</column>
<column>
<name>valueMap</name>
<scalar-type>string</scalar-type>
<val>valueMap</val>
<nullable>true</nullable>
<default>""</default>
</column>
<column>
<name>listValue</name>
<scalar-type>string</scalar-type>
<val>listValue</val>
<nullable>true</nullable>
<default>""</default>
</column>
</columns>
</row>
</rows>
</template>
return tde:template-insert("EntityTest.xml", $Entity_View, (),"TEMPLATE")
在执行 SQL 查询时,我得到以下结果:
main.entityView.instanceName | main.entityView.status | main.entityView.entityfieldName | main.entityView.entityfieldType | main.entityView.stringValue | main.entityView.valueMap | main.entityView.listValue |
---|---|---|---|---|---|---|
实例1 | 积极的 | 字符串数据 | 细绳 | 维克拉姆 | ||
实例1 | 积极的 | TwoValListData | 两个值列表 | F1V1F2V1F1V2F2V2 |
我想要不同列中的 valueMap 数据和我无法提取的 listValue 数据。