MarkLogic 9 Product Documentation
es.extractionTemplateGenerate

es.extractionTemplateGenerate(
   model as Object
) 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

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

es.extractionTemplateGenerate(
  es.modelValidate(
    { "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.
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy