xquerymarklogicmarklogic-optic-api

Minus function in Optic Query


I have requirement to do minus in one of the use case but in MarkLogic I am not able to use minus function. Is there any alternate way to do this?

select table1.value1 from table1 where table1.date = '2020-11-27'
minus
select table1.value1 from table1 where table1.date = '2020-11-26'

Solution

  • The "MINUS" operator is a SPARQL operator. Similar functionality is supported in MarkLogic's Optic API using the op:except() operator. You can also use the "MINUS" operator in SPARQL and op:from-sparql() in the Optic API, and the "EXCEPT" operator in SQL and op:from-sql() in the Optic API.