Skip to content

Commit c586dca

Browse files
committed
DEVEXP-592 : Submit Optic plan containing new operations in MarkLogic 11.1
1 parent c79bf7a commit c586dca

File tree

4 files changed

+173
-34
lines changed

4 files changed

+173
-34
lines changed

lib/plan-builder-base.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ function castArg(arg, funcName, paramName, argPos, paramTypes) {
417417
}
418418
break;
419419
case 'string':
420-
if (isProtoChained(paramTypes, [types.XsAnyAtomicType, types.TextNode, types.JsonContentNode, types.XmlContentNode])) {
420+
if (isProtoChained(paramTypes, [types.XsAnyAtomicType, types.TextNode, types.JsonContentNode, types.XmlContentNode,
421+
types.XsString])) {
421422
return arg;
422423
}
423424
break;

lib/plan-builder-generated.js

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,9 +1113,10 @@ periodRangeQuery(...args) {
11131113
point(...args) {
11141114
const namer = bldrbase.getNamer(args, 'latitude');
11151115
const paramdefs = [['latitude', [types.XsDouble, PlanColumn, PlanParam], true, false], ['longitude', [types.XsDouble, PlanColumn, PlanParam], true, false]];
1116+
// Changing minArity to 1 manually since cts.point now accepts string input (MarkLogic 11.1.0 or higher needed).
11161117
const checkedArgs = (namer !== null) ?
11171118
bldrbase.makeNamedArgs(namer, 'cts.point', 2, new Set(['latitude', 'longitude']), paramdefs, args) :
1118-
bldrbase.makePositionalArgs('cts.point', 2, false, paramdefs, args);
1119+
bldrbase.makePositionalArgs('cts.point', 1, false, paramdefs, args);
11191120
return new types.CtsPoint('cts', 'point', checkedArgs);
11201121

11211122
}
@@ -1151,7 +1152,8 @@ pointLongitude(...args) {
11511152
* @returns { CtsPolygon }
11521153
*/
11531154
polygon(...args) {
1154-
const paramdef = ['vertices', [types.CtsPoint, PlanColumn, PlanParam], false, true];
1155+
// Adding types.XsString manually since cts.polygon now accepts string input (MarkLogic 11.1.0 or higher needed).
1156+
const paramdef = ['vertices', [types.CtsPoint, PlanColumn, PlanParam, types.XsString], false, true];
11551157
const checkedArgs = bldrbase.makeSingleArgs('cts.polygon', 1, paramdef, args);
11561158
return new types.CtsPolygon('cts', 'polygon', checkedArgs);
11571159
}
@@ -3188,8 +3190,8 @@ geohashSubhashes(...args) {
31883190
const namer = bldrbase.getNamer(args, 'hash');
31893191
const paramdefs = [['hash', [types.XsString, PlanColumn, PlanParam], true, false], ['which', [types.XsString, PlanColumn, PlanParam], true, false]];
31903192
const checkedArgs = (namer !== null) ?
3191-
bldrbase.makeNamedArgs(namer, 'geo.geohashSubhashes', 2, new Set(['hash', 'which']), paramdefs, args) :
3192-
bldrbase.makePositionalArgs('geo.geohashSubhashes', 2, false, paramdefs, args);
3193+
bldrbase.makeNamedArgs(namer, 'geo.geohashSubhashes', 1, new Set(['hash', 'which']), paramdefs, args) :
3194+
bldrbase.makePositionalArgs('geo.geohashSubhashes', 1, false, paramdefs, args);
31933195
return new types.XsString('geo', 'geohash-subhashes', checkedArgs);
31943196

31953197
}
@@ -5393,8 +5395,8 @@ decodeFromNCName(...args) {
53935395
* @method planBuilder.xdmp#describe
53945396
* @since 2.1.1
53955397
* @param { Item } [item] - The item sequence whose description is returned.
5396-
* @param { XsUnsignedInt } [maxSequenceLength] - Represents the maximum number of items per sequence to print. The default is 3. () means no maximum.
5397-
* @param { XsUnsignedInt } [maxItemLength] - Represents the maximum number of characters per item to print. The default is 64. The minimum is 8. () means no limit.
5398+
* @param { XsUnsignedInt } [maxSequenceLength] - Represents the maximum number of items per sequence to print. The default is 3.
5399+
* @param { XsUnsignedInt } [maxItemLength] - Represents the maximum number of characters per item to print. The default is 64. The minimum is 8.
53985400
* @returns { XsString }
53995401
*/
54005402
describe(...args) {
@@ -7367,7 +7369,7 @@ orderBy(...args) {
73677369
* This method prepares the specified plan for execution as an optional final step before execution. Provides a client interface to a server function. See {@link http://docs.marklogic.com/ModifyPlan.prototype.prepare|ModifyPlan.prototype.prepare}
73687370
* @method planBuilder.ModifyPlan#prepare
73697371
* @since 2.1.1
7370-
* @param { XsInt } [optimize] - The optimization level, which can be 0, 1, or 2 (with 1 as the default).
7372+
* @param { XsInt } [optimize] - The optimization level, which can be 0, 1, or 2 (1 is mostly used).
73717373
* @returns { planBuilder.PreparePlan }
73727374
*/
73737375
prepare(...args) {
@@ -7428,7 +7430,7 @@ whereDistinct(...args) {
74287430
return new PlanModifyPlan(this, 'op', 'where-distinct', args);
74297431
}
74307432
/**
7431-
* Provides a client interface to a server function.
7433+
* Inserts or overwrites the documents identified by the uri column with the data supplied by the other document descriptor columns. Provides a client interface to a server function. See {@link http://docs.marklogic.com/ModifyPlan.prototype.write|ModifyPlan.prototype.write}
74327434
* @method planBuilder.ModifyPlan#write
74337435
* @since 3.1.0
74347436
* @param { PlanDocColsIdentifier } [docCols] - the docCols value.
@@ -7440,7 +7442,7 @@ write(...args) {
74407442
return new PlanModifyPlan(this, 'op', 'write', checkedArgs);
74417443
}
74427444
/**
7443-
* Provides a client interface to a server function.
7445+
* This method deletes a document from the database. If the document does not exist, this method does not throw an error. Provides a client interface to a server function. See {@link http://docs.marklogic.com/ModifyPlan.prototype.remove|ModifyPlan.prototype.remove}
74447446
* @method planBuilder.ModifyPlan#remove
74457447
* @since 3.1.0
74467448
* @param { PlanDocIdentifier } [removeCol] - the column containing URIs to be removed
@@ -7452,7 +7454,7 @@ remove(...args) {
74527454
return new PlanModifyPlan(this, 'op', 'remove', checkedArgs);
74537455
}
74547456
/**
7455-
* Provides a client interface to a server function.
7457+
* Gets an early lock on documents that will be updated later in the pipeline with an operation like remove() or write(). Documents are always locked, but for complex pipelines, it can be beneficial to lock the document early, so to minimize the potential for lock contention. Provides a client interface to a server function. See {@link http://docs.marklogic.com/ModifyPlan.prototype.lockForUpdate|ModifyPlan.prototype.lockForUpdate}
74567458
* @method planBuilder.ModifyPlan#lockForUpdate
74577459
* @since 3.1.0
74587460
* @param { PlanDocIdentifier } [lockUriCol] - the column containing URIs to be locked
@@ -7464,11 +7466,11 @@ lockForUpdate(...args) {
74647466
return new PlanModifyPlan(this, 'op', 'lock-for-update', checkedArgs);
74657467
}
74667468
/**
7467-
* Provides a client interface to a server function.
7469+
* This function applies a transformation to a column that contains documents. This transform module needs to be stored in the modules database. Provides a client interface to a server function. See {@link http://docs.marklogic.com/ModifyPlan.prototype.transformDoc|ModifyPlan.prototype.transformDoc}
74687470
* @method planBuilder.ModifyPlan#transformDoc
7469-
* @since 3.1.0
7470-
* @param { PlanDocIdentifier } [transformDocCol] - the column containing content to be transformed.
7471-
* @param { PlanTransformDef } [transformDef] - defines a transform to be used.
7471+
* @since 3.1.0
7472+
* @param { PlanDocIdentifier } [transformDocCol] - The 'kind' key of the schema map must be 'mjs'(the default), or 'xslt'. The 'path' key specifies the main module in the modules database. The 'params' key specifies parameter values passed to the main module. (refer to xdmp:invoke and xdmp:xslt-invoke).
7473+
* @param { PlanTransformDef } [transformDef] - defines a transform to be used.
74727474
* @returns { planBuilder.ModifyPlan }
74737475
*/
74747476
transformDoc(...args) {
@@ -7481,11 +7483,11 @@ transformDoc(...args) {
74817483

74827484
}
74837485
/**
7484-
* Provides a client interface to a server function.
7486+
* This function populates the view with the uri, doc, collections, metadata, permissions, and / or quality document descriptor columns for database document values. Provides a client interface to a server function. See {@link http://docs.marklogic.com/ModifyPlan.prototype.joinDocCols|ModifyPlan.prototype.joinDocCols}
74857487
* @method planBuilder.ModifyPlan#joinDocCols
7486-
* @since 3.1.0
7487-
* @param { PlanDocColsIdentifier } [cols] - Supplies a document column identifier object to specify which document columns to join and their names. The names cannot conflict with existing column names.
7488-
* @param { PlanColumnName } [docIdCol] - The document uri or fragment id value. This is either an op.fragmentIdCol object specifying a fragment id column or a document uri column.
7488+
* @since 3.1.0
7489+
* @param { PlanDocColsIdentifier } [cols] - The source column to join. This is either an op:fragment-id-col specifying a fragment id column or a op:col, op:view-col or op:schema-col that contains document uris. Joining on a fragment id is more efficient than joining on an uri column.
7490+
* @param { PlanColumnName } [docIdCol] - The document uri or fragment id value. This is either an op.fragmentIdCol object specifying a fragment id column or a document uri column.
74897491
* @returns { planBuilder.ModifyPlan }
74907492
*/
74917493
joinDocCols(...args) {
@@ -7498,12 +7500,12 @@ joinDocCols(...args) {
74987500

74997501
}
75007502
/**
7501-
* Provides a client interface to a server function.
7503+
* Validate the document based on a supplied schema. This schema needs to be stored in the schema database. Check appserver error log for validate errors. Provides a client interface to a server function. See {@link http://docs.marklogic.com/ModifyPlan.prototype.validateDoc|ModifyPlan.prototype.validateDoc}
75027504
* @method planBuilder.ModifyPlan#validateDoc
7503-
* @since 3.1.0
7504-
* @param { PlanColumnName } [validateDocCol] - Contains the document to validate.
7505-
* @param { PlanSchemaDef } [schemaDef] - This is an object. The required 'kind' property of the schema object must be 'jsonSchema', 'schematron', or 'xmlSchema'. When 'kind' is 'jsonSchema' or 'schemtron' then a property 'schemaUri' is required.
7506-
* Property 'mode' takes 'strict', 'lax' or 'type' (refer to xdmp.validate).
7505+
* @since 3.1.0
7506+
* @param { PlanColumnName } [validateDocCol] - The required 'kind' key of the schemaDef map must be 'jsonSchema', 'schematron', or 'xmlSchema'. When 'kind' is 'jsonSchema' or 'schemtron' then a key 'schemaUri' is required. Key 'mode' takes 'strict', 'lax' or 'type' (refer to xdmp:validate).
7507+
* @param { PlanSchemaDef } [schemaDef] - This is an object. The required 'kind' property of the schema object must be 'jsonSchema', 'schematron', or 'xmlSchema'. When 'kind' is 'jsonSchema' or 'schemtron' then a property 'schemaUri' is required.
7508+
* Property 'mode' takes 'strict', 'lax' or 'type' (refer to xdmp.validate).
75077509
* @returns { planBuilder.ModifyPlan }
75087510
*/
75097511
validateDoc(...args) {
@@ -7563,7 +7565,7 @@ class PlanAccessPlan extends PlanModifyPlan {
75637565
super(prior, ns, fn, args);
75647566
}
75657567
/**
7566-
* This method identifies a column, where the column name is unique. A qualifier on the column name isn't necessary (and might not exist). In positions where only a column name can appear, the unqualified column name can also be provided as a string. Qualified column names cannot be provided as a string. Provides a client interface to a server function. See {@link http://docs.marklogic.com/op.col|op.col}
7568+
* Identifies a column where the column name is unique and a qualifier on the column name isn't necessary (and might not exist). Provides a client interface to a server function. See {@link http://docs.marklogic.com/op.col|op.col}
75677569
* @method planBuilder.AccessPlan#col
75687570
* @since 2.1.1
75697571
* @param { XsString } [column] - The Optic AccessorPlan created by op:from-view, op:from-triples, or op:from-lexicons.
@@ -7965,7 +7967,7 @@ param(...args) {
79657967
return new PlanParam('op', 'param', checkedArgs);
79667968
}
79677969
/**
7968-
* This method identifies a column, where the column name is unique. A qualifier on the column name isn't necessary (and might not exist). In positions where only a column name can appear, the unqualified column name can also be provided as a string. Qualified column names cannot be provided as a string. Provides a client interface to a server function. See {@link http://docs.marklogic.com/op.col|op.col}
7970+
* Identifies a column where the column name is unique and a qualifier on the column name isn't necessary (and might not exist). Provides a client interface to a server function. See {@link http://docs.marklogic.com/op.col|op.col}
79697971
* @method planBuilder#col
79707972
* @since 2.1.1
79717973
* @param { XsString } [column] - The Optic AccessorPlan created by op:from-view, op:from-triples, or op:from-lexicons.
@@ -8233,7 +8235,7 @@ fromSearch(...args) {
82338235
* @since 3.1.0
82348236
* @param { XsString } [paramName] - The paramName parameter specifies the placeholder parameter supplying the rows.
82358237
* @param { XsString } [qualifier] - Specifies a name for qualifying the column names.
8236-
* @param { PlanRowColTypes } [rowColTypes] - Describes the columns with an array of JavaScript objects. It's a combinations of column, type and nullable. The 'column' is the column name, which is required. The 'type' is the optional type of the column, which can be an atomic type or the default of none. The 'nullable' is an optional boolean defaulting to false. If your rows contains only uri, doc, collections, metadata, permissions, quality and temporalCollection columns, you could simply use op.docColTypes instead.
8238+
* @param { PlanRowColTypes } [rowColTypes] - Describes the columns with a sequence of maps. It's a combinations of column, type and nullable. The 'column' is the column name, which is required. The 'type' is the optional type of the column, which can be an atomic type or the default of none. The 'nullable' is an optional boolean defaulting to false. If your rows contains only uri, doc, collections, metadata, permissions, quality and temporalCollection columns, you could simply use op:doc-col-types instead.
82378239
* @returns { planBuilder.AccessPlan }
82388240
*/
82398241
fromParam(...args) {
@@ -8248,8 +8250,8 @@ fromParam(...args) {
82488250
/**
82498251
* This function constructs document rows from the docsDescriptors. Provides a client interface to a server function. See {@link http://docs.marklogic.com/op.fromDocDescriptors|op.fromDocDescriptors}
82508252
* @method planBuilder#fromDocDescriptors
8251-
* @since 3.1.0
8252-
* @param { PlanDocDescriptor } [docDescriptor] - An array of document descriptors. Each document descriptor describes a document. A document descriptor contains a combination of uri, doc, collections, metadata, permissions, quality and temporalCollection. This is a simpler form of op.fromParam.
8253+
* @since 3.1.0
8254+
* @param { PlanDocDescriptor } [docDescriptor] - A map of document descriptors. Each document descriptor describes a document. A document descriptor contains a combination of uri, doc, collections, metadata, permissions, quality and temporalCollection. This is a simpler form of op:from-param.
82538255
* @param { XsString } [qualifier] - Specifies a name for qualifying the column names.
82548256
* @returns { planBuilder.AccessPlan }
82558257
*/
@@ -8265,8 +8267,8 @@ fromDocDescriptors(...args) {
82658267
/**
82668268
* This function matches and returns the uri, content, and score for documents. Provides a client interface to a server function. See {@link http://docs.marklogic.com/op.fromDocUris|op.fromDocUris}
82678269
* @method planBuilder#fromDocUris
8268-
* @since 3.1.0
8269-
* @param { PlanQueryDef } [querydef] - Qualifies a set of documents. The query can be a cts.query or as an array of document URI string literals.
8270+
* @since 3.1.0
8271+
* @param { PlanQueryDef } [querydef] - Qualifies a set of documents. The query can be a cts:query or as a sequence of document URI string literals.
82708272
* @param { XsString } [qualifier] - Specifies a name for qualifying the column names.
82718273
* @returns { planBuilder.AccessPlan }
82728274
*/
@@ -8894,11 +8896,11 @@ resolveFunction(...args) {
88948896

88958897
}
88968898
/**
8897-
* Constructs a document column identifier object for columns of uri, doc, collections, metadata, permissions, quality and temporalCollection. The document column identifier object can be passed to the prototype.joinDocCols or prototype.write. Provides a client interface to a server function. See {@link http://docs.marklogic.com/op.docCols|op.docCols}
8899+
* Constructs a document column identifier object for columns of uri, doc, collections, metadata, permissions, quality and temporalCollection. The document column identifier object can be passed to the op:join-doc-cols or op:write. Provides a client interface to a server function. See {@link http://docs.marklogic.com/op.docCols|op.docCols}
88988900
* @method planBuilder#docCols
88998901
* @since 2.1.1
89008902
* @param { XsString } [qualifier] - Specifies a name for qualifying the column names.
8901-
* @param { XsString } [names] - An array of columns names, a combination of uri, doc, collections, metadata, permissions, quality and temporalCollection.
8903+
* @param { XsString } [names] - A sequence of columns names, a combination of uri, doc, collections, metadata, permissions, quality and temporalCollection.
89028904
* @returns { planBuilder.PlanDocColsIdentifier }
89038905
*/
89048906
docCols(...args) {
@@ -8911,7 +8913,7 @@ docCols(...args) {
89118913

89128914
}
89138915
/**
8914-
* Provides the 3rd parameter for op.fromParam for row column types. Provides a client interface to a server function. See {@link http://docs.marklogic.com/op.docColTypes|op.docColTypes}
8916+
* Provides the 3rd parameter for op:from-param for row column types. Provides a client interface to a server function. See {@link http://docs.marklogic.com/op.docColTypes|op.docColTypes}
89158917
* @method planBuilder#docColTypes
89168918
* @since 2.1.1
89178919

0 commit comments

Comments
 (0)