Template Driven Extraction (TDE) enables you to define a relational lens over your document data, so you can query parts of your data using SQL or the Optic API. Templates let you specify which parts of documents make up rows in a view. You can also use templates to define a semantic lens, specifying which values from a document make up triples in the triple index.

TDE enables you to generate rows and triples from ingested documents based on predefined templates that describe the following:

  • The input data to match
  • The data transformations that apply to the matched data
  • The final data projections that are translated into indexed data

TDE enables you to access the data in your documents in several ways, without changing the documents themselves. A relational lens is useful when you want to let SQL-savvy users access your data and when users want to create reports and visualizations using tools that communicate using SQL. It is also useful when you want to join entities and perform aggregates across documents. A semantic lens is useful when your documents contain some data that is naturally represented and queried as triples, using SPARQL.

TDE is applied during indexing at ingestion time and serves the following purposes:

TDE data is also used by the Optic API, as described in Optic API for Multi-Model Data Access.

Learn More

TDE Documentation

Explore the documentation on how to get started with Template Driven Extraction in the Application Developer’s Guide.


Developers answer your frequently asked questions concerning Template Driven Extraction and how to use it in MarkLogic.

TDE Tutorial

Learn how to work with templates in MarkLogic through a relational or through a semantics lens.

Quick and Small-Scale TDE Testing

Learn how to do small-scale TDE extraction and SPARQL testing or development using Query Console and files on disk.

Use an IRI Namespace with TDE

Learn how to reuse a namespace while generating triples with template driven extraction.

Extract content from retrieved documents

Learn how to return pieces of information you want to return after using TDE to extract data from documents into the row index.

Disable TDE Templates

Learn how to disable and delete a template. In order to do so, it must be re-inserted in a disabled state with the same URI.

Enable and Disable Templates

Read the documentation on how to enable and disable templates by modifying the <enabled> flag.

Identify Triples with Templates

Learn how to define a template to identify data to be indexed as triples in an existing document.

This website uses cookies.

By continuing to use this website you are giving consent to cookies being used in accordance with the MarkLogic Privacy Statement.