MarkLogic 12 EA 1 Product Documentation
op:exists-join

op:exists-join(
   $leftPlan as map:map,
   $rightPlan as map:map,
   [$keys as map:map*],
   [$condition as map:map?]
) as map:map

Summary

This method is a filtering join that filters based on whether the join exists or not but doesn't add any columns.

It filters the left row set to the rows that have a join in the right row set.

Parameters
$leftPlan The row set from the left view.
$rightPlan The row set from the right view.
$keys The equijoin from one or more calls to the op:on function.
$condition A boolean expression that filters the join output rows.

Example

(: It filters out {'r1':1, 'k1':'a'} in p1 as value 'a' exists in column 'k2' of p2 :)
xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-literals((
  map:entry("r1", 1) => map:with("k1", "a"),
  map:entry("r1", 2) => map:with("k1", "b")
))
=> op:exists-join(
     op:from-literals((
       map:entry("r2", 3) => map:with("k2", "a"),
       map:entry("r2", 4) => map:with("k2", "c")
     )),
     op:on("k1", "k2")
   )
=> op:result()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy