Loading TOC...

MarkLogic 12 Product Documentation
temporal:axis-create

temporal:axis-create(
   $axis-name as xs:string,
   $start-range-index as cts:reference,
   $end-range-index as cts:reference
) as xs:unsignedLong

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

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

xquery version "1.0-ml"; 
 
import module namespace temporal = "http://marklogic.com/xdmp/temporal" 
      at "/MarkLogic/temporal.xqy";

temporal:axis-remove("system"),
temporal:axis-remove("valid"),
temporal:axis-create(
   "system",
   cts:element-reference(xs:QName("systemStart")),
   cts:element-reference(xs:QName("systemEnd"))),
temporal:axis-create(
   "valid",
   cts:element-reference(xs:QName("validStart")),
   cts:element-reference(xs:QName("validEnd")))

   (: 
      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.