final Configuration config = new Configuration();
final StaticQueryContext sqc = new StaticQueryContext(config);
final XQueryExpression exp = sqc.compileQuery("avg(for $i in 1 to 10 return $i*$i)");
final DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
final BigDecimal result = (BigDecimal)exp.evaluateSingle(dynamicContext);
System.out.println(result);
}
/**