
temporal.axisCreate( axis-name as String, start-range-index as cts.reference, end-range-index as cts.reference ) as (Number|String)
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
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.
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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.