es.instanceConverterGenerate( model as Object ) as Node
This function is deprecated and will not be supported in MarkLogic 11.
Generate an XQuery library module containing stub code for converting
source data to entity instances.
Parameters | |
---|---|
model | A valid basic entity model. |
The output of this function is an XQuery library module containing boilerplate code you can customize for ingestion scenarios. You must insert the generated module into your modules database to use it.
The generated module contains code to get you started on a data integration pipeline. The module also contains comments that explain the default code and provide tips for customization.
The generated code is runnable out-of-the-box, but the default implementation is suitable for only those entity instances that already conform to the canonical representation. Any transform from source systems should be implemented by customizing the generated functions.
const es = require('/MarkLogic/entity-services/entity-services'); es.instanceConverterGenerate( 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" ] } } } )); // ==> An XQuery library module containing functions such as // example:extract-instance-Name, example:extract-instance-Person, // example:instance-to-canonical-xml, and example:instance-to-envelope.
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.