op:from-lexicons

op:from-lexicons(
   $columnBindings as map:map,
   $qualifier as xs:string?,
   [$systemCols as map:map?]
) as map:map

Summary

This function dynamically constructs a view from range indexes or the uri or collection lexicons. This function will only return rows for documents where the first column has a value. The keys in the map specify the names of the columns and the values in the map provide cts:reference objects to specify the lexicon providing the values of the columns. Optic emits rows based on co-occurrence of lexicon values within the same document similar to cts:value-tuples If the cts:reference sets the nullable option to true, the column is optional in the row.

This function creates a row set without a limit. Use op:limit or op:offset-limit to set a limit.

Parameters
$columnBindings An object in which each key is a column name and each value specifies a cts:reference for a range index or other lexicon (especially the cts:uri-reference lexicon) with the column values.
$qualifier Specifies a name for qualifying the column names. By default, lexicon rows have no qualification. Use cases for the qualifier include self joins. Using an empty string removes all qualification from the column names.
$systemCols An optional named fragment id column returned by the op:fragment-id-col function. The fragment id column can be used for joins.

Example

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-lexicons(
   map:entry("EmployeeID", cts:element-reference(xs:QName("EmployeeID"))),
   "myview",
   op:fragment-id-col("Document Fragment"))
=> op:result()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy