Loading TOC...

MarkLogic Server 11.0 Product Documentation
cts.periodCompareQuery

cts.periodCompareQuery(
   axis-1 as String,
   operator as String,
   axis-2 as String,
   [options as String[]]
) as cts.periodCompareQuery

Summary

Returns a cts:query matching documents that have relevant pair of period values. Searches with the cts:period-compare-query constructor require two valid names of period, if the either of the specified period does not exist, then an exception is thrown.

Parameters
axis-1 Name of the first axis to compare
operator A comparison operator. Period is the two timestamps contained in the axis.

Operators include:

"aln_equals"
Match documents whose period1 equals period2.
"aln_contains"
Match documents whose period1 contains period2. i.e. period1 starts before period2 starts and ends before period2 ends.
"aln_contained_by"
Match documents whose period1 is contained by period2.
"aln_meets"
Match documents whose period1 meets period2, i.e. period1 ends at period2 start.
"aln_met_by"
Match documents whose period1 meets period2, i.e. period1 starts at period2 end.
"aln_before"
Match documents whose period1 is before period2, i.e. period1 ends before period2 starts.
"aln_after"
Match documents whose period1 is after period2, i.e. period1 starts after period2 ends.
"aln_starts"
Match documents whose period1 starts period2, i.e. period1 starts at period2 start and ends before period2 ends.
"aln_started_by"
Match documents whose period2 starts period1, i.e. period1 starts at period2 start and ends after period2 ends.
"aln_finishes"
Match documents whose period1 finishes period2, i.e. period1 finishes at period2 finish and starts after period2 starts.
"aln_finished_by"
Match documents whose period2 finishes period1, i.e. period1 finishes at period2 finish and starts before period2 starts.
"aln_overlaps"
Match documents whose period1 overlaps period2, i.e. period1 starts before period2 start and ends before period2 ends but after period2 starts.
"aln_overlapped_by"
Match documents whose period2 overlaps period1, i.e. period1 starts after period2 start but before period2 ends and ends after period2 ends.
"iso_contains"
Match documents whose period1 contains period2 in sql 2011 standard. i.e. period1 starts before or at period2 starts and ends after or at period2 ends.
"iso_overlaps"
Match documents whose period1 overlaps period2 in sql 2011 standard. i.e. period1 and period2 have common time period.
"iso_succeeds"
Match documents whose period1 succeeds period2 in sql 2011 standard. i.e. period1 starts at or after period2 ends
"iso_precedes"
Match documents whose period1 precedes period2 in sql 2011 standard. i.e. period1 ends at or before period2 ends
"iso_succeeds"
Match documents whose period1 succeeds period2 in sql 2011 standard. i.e. period1 starts at or after period2 ends
"iso_precedes"
Match documents whose period1 precedes period2 in sql 2011 standard. i.e. period1 ends at or before period2 ends
"iso_imm_succeeds"
Match documents whose period1 immediately succeeds period2 in sql 2011 standard. i.e. period1 starts at period2 ends
"iso_imm_precedes"
Match documents whose period1 immediately precedes period2 in sql 2011 standard. i.e. period1 ends at period2 ends
axis-2 Name of the second period to compare
options Options to this query. The default is ().

Options include:

"cached"
Cache the results of this query in the list cache.
"uncached"
Do not cache the results of this query in the list cache.

Usage Notes

If you want to constrain on a range of period comparisons, you can combine multiple cts: constructors together with cts:and-query or any of the other composable cts:query constructors, as in the last part of the example below.

If neither "cached" nor "uncached" is present, it specifies "cached".

Negative "min-occurs" or "max-occurs" values will be treated as 0 and non-integral values will be rounded down. An error will be raised if the "min-occurs" value is greater than the "max-occurs" value.

Example

cts.periodCompareQuery("system","aln_overlaps","valid",
    "cached", xs.double("3.13"));

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