Loading TOC...

temporal.axisCreate

temporal.axisCreate(
   axis-name as String,
   start-range-index as cts.reference,
   end-range-index as cts.reference
) as (Number|String)

Summary

This function constructs an axis definition based on the existing range indexes that can be added to a temporal collection in subsequent API calls. The axis definition is stored in the schema database.

For details on how to create an axis, see Create System and Valid Axes in the Temporal Developer's Guide

A TEMPORAL-NONDATETIME exception is thrown if range index scalar type is not dateTime. A TEMPORAL-DUPAXIS exception is thrown if the axis already exists.

Parameters
axis-name The name to be used to identify the axis.
start-range-index A reference to a range index to be used as the start of the time period.
end-range-index A reference to a range index to be used as the end of the time period.

Example

const temporal = require("/MarkLogic/temporal.xqy");

temporal.axisRemove("system");
temporal.axisRemove("valid");
const output = new Array();
output.push(
  temporal.axisCreate(
   "system",
   cts.elementReference(xs.QName("systemStart")),
   cts.elementReference(xs.QName("systemEnd"))) 
  );

output.push(
  temporal.axisCreate(
   "valid",
   cts.elementReference(xs.QName("validStart")),
   cts.elementReference(xs.QName("validEnd"))) 
  );
output;

// First removes, then creates two axes, named "system" and "valid",
// from the element range indexes, "systemStart", "systemEnd",
// "validStart", and "validEnd".  Then it returns the IDs of the
// new axes.

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.