Loading TOC...


   model as Object
) as element(tde.template)


This function is deprecated and will be removed in a future release.
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.

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


const es = require('/MarkLogic/entity-services/entity-services');

    { "info": {
        "title": "Example",
        "version": "1.0.0",
        "description": "ES Examples"
      "definitions": {
        "Name": {
          "properties": {
            "first": { "datatype": "string" },
            "middle": { "datatype": "string" },
            "last": { "datatype": "string" }
          "required": [ "first", "last" ]
        "Person": {
          "properties": {
            "id": { "datatype": "int" },
            "name": { "$ref": "#/definitions/Name" },
            "bio": { "datatype": "string" },
            "rating": { "datatype": "float" },
            "phone": {
              "datatype": "array",
              "items": { "datatype": "string" }
          "primaryKey": "id",
          "required": [ "id", "name" ]
    } } }

// Result: A TDE template (XML) 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.