Loading TOC...

es:extraction-template-generate

es:extraction-template-generate(
   model as map:map
) as element(tde:template)

Summary

This function is deprecated and will not be supported in MarkLogic 11.
Generate a Template Driven Extraction (TDE) template you can use to render entity instance data into rows for querying with the Optic API or SQL.

Parameters
model A valid basic entity model.

Usage Notes

Use this function to generate an extraction template. The template enables SQL and Optic API use with instance data. You can use the template as-is or customize it. You must install the template in your schemas database before you can use it.

See Also

Example

xquery version "1.0-ml";
import module namespace es = "http://marklogic.com/entity-services"
  at "/MarkLogic/entity-services/entity-services.xqy";

es:extraction-template-generate(
  es:model-from-xml(
    <es:model xmlns:es="http://marklogic.com/entity-services">
      <es:info>
        <es:title>Example</es:title>
        <es:version>1.0.0</es:version>
        <es:description>ES Examples</es:description>
      </es:info>
      <es:definitions>
        <Name>
          <es:properties>
            <first><es:datatype>string</es:datatype></first>
            <middle><es:datatype>string</es:datatype></middle>
            <last><es:datatype>string</es:datatype></last>
          </es:properties>
          <es:required>first</es:required>
          <es:required>last</es:required>
        </Name>
        <Person>
          <es:properties>
            <id><es:datatype>int</es:datatype></id>
            <name><es:ref>#/definitions/Name</es:ref></name>
            <bio><es:datatype>string</es:datatype></bio>
            <rating><es:datatype>float</es:datatype></rating>
            <phone>
              <es:datatype>array</es:datatype>
              <es:items><es:datatype>string</es:datatype></es:items>
            </phone>
          </es:properties>
          <es:primary-key>id</es:primary-key>
          <es:required>id</es:required>
          <es:required>name</es:required>
        </Person>
      </es:definitions>
    </es:model>
))

(: ==> A TDE template that defines how to express your entity instances
 :     as rows. :)
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.