@@ -83,6 +83,18 @@ function addIndex(query, index, isContainer) {
8383 * or path index.
8484 * @typedef {object } queryBuilder.IndexedName
8585 */
86+ /**
87+ * The specification of a point or an area (such as a box, circle, or polygon)
88+ * for use as criteria in a geospatial query.
89+ * @typedef {object } queryBuilder.Region
90+ */
91+ /**
92+ * The specification of the latitude and longitude
93+ * returned by the {@link queryBuilder#latlon} function
94+ * for a coordinate of a {@link queryBuilder.Region}.
95+ * @typedef {object } queryBuilder.LatLon
96+ */
97+
8698
8799/**
88100 * Builds a query for the intersection of the subqueries.
@@ -217,6 +229,19 @@ function boost() {
217229 } } ;
218230 }
219231}
232+ /**
233+ * Specifies a rectangular region with the coordinates of the corners.
234+ * The coordinates can either be specified either by passing the return value
235+ * from the {@link queryBuilder#southWestNorthEast} function or as a list
236+ * of points in South, West, North, and East order.
237+ * @method
238+ * @memberof queryBuilder#
239+ * @param {queryBuilder.LatLon } south - the south coordinate of the box
240+ * @param {queryBuilder.LatLon } west - the west coordinate for the box
241+ * @param {queryBuilder.LatLon } north - the north coordinate for the box
242+ * @param {queryBuilder.LatLon } east - the east coordinate for the box
243+ * @returns {queryBuilder.Region } the region criteria for a geospatial query
244+ */
220245function box ( ) {
221246 var args = mlutil . asArray . apply ( null , arguments ) ;
222247 var region = null ;
@@ -245,6 +270,17 @@ function box() {
245270 }
246271 return { box : region } ;
247272}
273+ /**
274+ * Specifies a circular region based on a radius and the coordinate of the center.
275+ * The coordinate can either be specified by passing the return value from
276+ * the {@link queryBuilder#latlon} function or by passing the latitude and longitude
277+ * numbers in that order (possibly wrapped in an array).
278+ * @method
279+ * @memberof queryBuilder#
280+ * @param {number } radius - the radius for the circle
281+ * @param {queryBuilder.LatLon } center - the center for the circle
282+ * @returns {queryBuilder.Region } the region criteria for a geospatial query
283+ */
248284function circle ( ) {
249285 var args = mlutil . asArray . apply ( null , arguments ) ;
250286 var query = { } ;
@@ -333,6 +369,25 @@ function collection() {
333369 uri : args
334370 } } ;
335371}
372+ /**
373+ * Builds a query matching temporal documents with a system start time
374+ * prior to the LSQT (Latest System Query Time). Advancing the LSQT can be
375+ * done manually or on an automated basis to include more recent
376+ * temporal documents in the result set.
377+ * @method
378+ * @memberof queryBuilder#
379+ * @param {string } temporalCollection - the name of the temporal collection
380+ * that retains the temporal documents
381+ * @param {queryBuilder.WeightParam } [weight] - a weight returned
382+ * by {@link queryBuilder#weight} to increase or decrease the score
383+ * of subqueries relative to other queries in the complete search
384+ * @param {string|Date } [timestamp] - a datetime older than the LSQT
385+ * to use as the upper boundary for an older view of the database
386+ * @param {queryBuilder.TemporalOptionsParam } [temporalOptions] - a list
387+ * of options returned by {@link queryBuilder#temporalOptions} to modify
388+ * the temporal query
389+ * @returns {queryBuilder.Query } a composable query
390+ */
336391function lsqtQuery ( ) {
337392 var args = mlutil . asArray . apply ( null , arguments ) ;
338393 var argLen = args . length ;
@@ -589,7 +644,21 @@ function fragmentScope() {
589644 }
590645 throw new Error ( 'unknown argument: ' + scope ) ;
591646}
592- // TODO: jsdoc for geospatial
647+
648+ /**
649+ * Builds a query for a geospatial location represented by an XML attribute pair
650+ * that matches the {queryBuilder.Region} criteria.
651+ * The coordinates can either be specified either by passing the return value
652+ * from the {@link queryBuilder#southWestNorthEast} function or as a list
653+ * of points in South, West, North, and East order.
654+ * @method
655+ * @memberof queryBuilder#
656+ * @param {string|string[]|queryBuilder.BindingParam } collections - either
657+ * one or more collection uris to match or exactly one binding (returned
658+ * by the {@link queryBuilder#bind} function) for parsing the collection
659+ * uris from a query string; required except for values queries
660+ * @returns {queryBuilder.Query } a composable query
661+ */
593662function geoAttributePair ( ) {
594663 var args = mlutil . asArray . apply ( null , arguments ) ;
595664 if ( args . length < 3 ) {
@@ -877,6 +946,16 @@ function heatmap() {
877946function geoOptions ( ) {
878947 return { 'geo-option' : mlutil . asArray . apply ( null , arguments ) } ;
879948}
949+ /**
950+ * Specifies the latitude and longitude for a coordinate of the region
951+ * criteria for a geospatial query. The latitude and longitude can be
952+ * passed as individual numeric parameters or wrapped in an array
953+ * @method
954+ * @memberof queryBuilder#
955+ * @param {number } latitude - the north-south location
956+ * @param {number } longitude - the east-west location
957+ * @returns {queryBuilder.LatLon } a coordinate for a {queryBuilder.Region}
958+ */
880959function latlon ( ) {
881960 var args = mlutil . asArray . apply ( null , arguments ) ;
882961 if ( args . length !== 2 )
@@ -1030,6 +1109,15 @@ function pathIndex() {
10301109 }
10311110 return { 'path-index' : query } ;
10321111}
1112+ /**
1113+ * Specifies a point region either by passing the return value from
1114+ * the {@link queryBuilder#latlon} function or by passing the latitude and longitude
1115+ * numbers in that order (possibly wrapped in an array).
1116+ * @method
1117+ * @memberof queryBuilder#
1118+ * @param {queryBuilder.LatLon } coordinate - the point location
1119+ * @returns {queryBuilder.Region } the region criteria for a geospatial query
1120+ */
10331121function point ( ) {
10341122 var args = mlutil . asArray . apply ( null , arguments ) ;
10351123 var region = null ;
@@ -1052,6 +1140,16 @@ function point() {
10521140 }
10531141 return { point : [ region ] } ;
10541142}
1143+ /**
1144+ * Specifies a polygon region as a list of coordinate parameters or as a coordinate array
1145+ * where each coordinate is specified either by the return value from
1146+ * the {@link queryBuilder#latlon} function or by wrapping the latitude and
1147+ * longitude numbers in an array.
1148+ * @method
1149+ * @memberof queryBuilder#
1150+ * @param {...queryBuilder.LatLon } coordinate - the polygon coordinates
1151+ * @returns {queryBuilder.Region } the region criteria for a geospatial query
1152+ */
10551153function polygon ( ) {
10561154 var args = mlutil . asArray . apply ( null , arguments ) ;
10571155 var points = [ ] ;
@@ -1124,6 +1222,24 @@ function nsName() {
11241222 throw new Error ( 'too many arguments: ' + args . length ) ;
11251223 }
11261224}
1225+ /**
1226+ * The specification for a timespan or timestamp for an query
1227+ * returned by the {@link queryBuilder#period} function.
1228+ * @typedef {object } queryBuilder.PeriodParam
1229+ */
1230+ /**
1231+ * Specifies a timespan or timestamp for comparison with
1232+ * a valid or system timespan in temporal documents in
1233+ * a {@link queryBuilder#periodRange} temporal query.
1234+ * @method
1235+ * @memberof queryBuilder#
1236+ * @param {string|Date } startTimestamp - the starting datetime for a timespan
1237+ * or the datetime for a timestamp
1238+ * @param {string|Date } [endTimestamp] - the starting datetime for a timespan
1239+ * or the datetime for a timestamp
1240+ * @returns {queryBuilder.PeriodParam } the specification of a period
1241+ * for a {@link queryBuilder#periodRange} temporal query
1242+ */
11271243function period ( ) {
11281244 var startDate = null ;
11291245 var endDate = null ;
@@ -1162,6 +1278,24 @@ function period() {
11621278
11631279 return periodVal ;
11641280}
1281+ /**
1282+ * Builds a query matching temporal documents based on the relationship
1283+ * between the valid period and the system period. For instance, this
1284+ * query can find cases where what was believed to be true (the valid time)
1285+ * was recorded (the system time) only afterward (the valid axis is before
1286+ * the system axis).
1287+ * @method
1288+ * @memberof queryBuilder#
1289+ * @param {string } axis1 - the configured name of the valid or system axis
1290+ * @param {string } operator - the name of an Allen interval operator or
1291+ * ISO SQL 2011 period operator
1292+ * @param {string } axis2 - the configured name of the valid or system axis, which
1293+ * must be different from axis1
1294+ * @param {queryBuilder.TemporalOptionsParam } [temporalOptions] - a list
1295+ * of options returned by {@link queryBuilder#temporalOptions} to modify
1296+ * the temporal query
1297+ * @returns {queryBuilder.Query } a composable query
1298+ */
11651299function periodCompare ( ) {
11661300 var argLen = arguments . length ;
11671301
@@ -1194,6 +1328,25 @@ function periodCompare() {
11941328
11951329 return { 'period-compare-query' : query } ;
11961330}
1331+ /**
1332+ * Builds a query matching temporal documents based on the relationship
1333+ * between the valid or system period and the specified period.
1334+ * This query can find what was believed to be true (the valid time)
1335+ * or was recorded (the system time) during a timespan or before or
1336+ * after a time.
1337+ * @method
1338+ * @memberof queryBuilder#
1339+ * @param {string } axis - the configured name of the valid or system axis
1340+ * @param {string } operator - the name of an Allen interval operator or
1341+ * ISO SQL 2011 period operator
1342+ * @param {queryBuilder.PeriodParam } [period] - a timespan or timestamp
1343+ * returned by {@link queryBuilder#period} to compare with the valid or
1344+ * system time of temporal documents
1345+ * @param {queryBuilder.TemporalOptionsParam } [temporalOptions] - a list
1346+ * of options returned by {@link queryBuilder#temporalOptions} to modify
1347+ * the temporal query
1348+ * @returns {queryBuilder.Query } a composable query
1349+ */
11971350function periodRange ( ) {
11981351 var argLen = arguments . length ;
11991352
@@ -1233,6 +1386,20 @@ function periodRange() {
12331386
12341387 return { 'period-range-query' : query } ;
12351388}
1389+ /**
1390+ * Options for an query returned by the {@link queryBuilder#temporalOptions}
1391+ * function.
1392+ * @typedef {object } queryBuilder.TemporalOptionsParam
1393+ */
1394+ /**
1395+ * Provides options modifying the default behavior
1396+ * of an {@link queryBuilder#lsqtQuery}, {@link queryBuilder#periodCompare},
1397+ * or {@link queryBuilder#periodRange} query.
1398+ * @method
1399+ * @memberof queryBuilder#
1400+ * @param {...string } options - options supported for temporal queries
1401+ * @returns {queryBuilder.TemporalOptionsParam } options for the temporal query
1402+ */
12361403function temporalOptions ( ) {
12371404 return { 'temporal-option' : mlutil . asArray . apply ( null , arguments ) } ;
12381405}
@@ -1376,6 +1543,17 @@ function range() {
13761543function rangeOptions ( ) {
13771544 return { 'range-option' : mlutil . asArray . apply ( null , arguments ) } ;
13781545}
1546+ /**
1547+ * A convenience for specifying the coordinates of a box as a list of parameters.
1548+ * @method
1549+ * @memberof queryBuilder#
1550+ * @param {queryBuilder.LatLon } south - the south coordinate
1551+ * @param {queryBuilder.LatLon } west - the west coordinate
1552+ * @param {queryBuilder.LatLon } north - the north coordinate
1553+ * @param {queryBuilder.LatLon } east - the east coordinate
1554+ * @returns {object } the coordinates for passing to
1555+ * the {@link queryBuilder#box} function to specify a region
1556+ */
13791557function southWestNorthEast ( ) {
13801558 var args = mlutil . asArray . apply ( null , arguments ) ;
13811559 if ( args . length !== 4 ) {
@@ -1881,7 +2059,7 @@ function transform(name, params) {
18812059 return { 'document-transform' : transformList } ;
18822060}
18832061
1884- // TODO: jsDoc for snippet
2062+ // TODO: jsDoc for snippet, extract, transform
18852063/**
18862064 * Sets the slice clause of a built query to select a slice of documents
18872065 * from the result set based on the start document within the result set
0 commit comments