2

Is it possible to call java function using XQuery in MarkLogic. ?

Please refer - https://stackoverflow.com/questions/65953901/calling-java-method-from-xquery

Example -

declare namespace math="java:java.lang.Math";
math:sqrt(2)
DevNinja
  • 1,459
  • 7
  • 10
  • 1
    At least for math functions you usually don't need other languages as `https://docs.marklogic.com/math:sqrt` https://docs.marklogic.com/math:sqrt exists. – Martin Honnen Jun 13 '21 at 10:39
  • 2
    https://stackoverflow.com/questions/54106085/call-java-from-marklogic-xquery-module suggests in-process calls to Java are not supported. – Martin Honnen Jun 13 '21 at 10:47

1 Answers1

1

There's no way to directly call a Java function from MarkLogic XQuery. If the Java code is accessible through a web service, you can use xdmp:http-get and similar.

As noted by Martin, depending on what functionality you're trying to access, you might not need to use Java.

Dave Cassel
  • 8,352
  • 20
  • 38