Skip to content

Instantly share code, notes, and snippets.

@lsharada
lsharada / gist:4df299e5c0010280819b
Created June 12, 2015 12:33
memoization - a step ahead of recursion
http://docs.marklogic.com/guide/performance/perftune -- performance tuning
xquery version "1.0-ml";
(: xquery memoization example for use with MarkLogic :)
declare variable $cache := map:map();
declare function local:books-by-author($a as element(b:author))
@lsharada
lsharada / gist:a8725bcd70e804b4ff6e
Created June 12, 2015 12:30
reverse engineer an xquery
steps
1.Create a simple java program that either call or embed an xquery
2.Input the java program into Altova UML/any open source available for java for creating sequence diagram
import javax.xml.xquery.*;
import net.cfoster.sedna.xqj.SednaXQDataSource;
public class SimpleQuery
{
/**
import java.lang.reflect.Method;
import javassist.*;
import java.security.*;
import java.lang.instrument.*;
class Hello {
public void say(int a) {
System.out.println("Hello"+a);