Search in sources :

Example 1 with XQueryEvaluator

use of org.sirix.saxon.evaluator.XQueryEvaluator in project sirix by sirixdb.

the class TestNodeWrapperS9ApiXQuery method testWhereBooks.

@Test
public void testWhereBooks() throws Exception {
    final XdmValue value = new XQueryEvaluator("for $x in /bookstore/book where $x/price>30 return $x/title", mHolder.getSession()).call();
    final StringBuilder strBuilder = new StringBuilder();
    for (final XdmItem item : value) {
        strBuilder.append(item.toString());
    }
    assertEquals("<title lang=\"en\">XQuery Kick Start</title><title lang=\"en\">Learning XML</title>", strBuilder.toString());
}
Also used : XdmValue(net.sf.saxon.s9api.XdmValue) XQueryEvaluator(org.sirix.saxon.evaluator.XQueryEvaluator) XdmItem(net.sf.saxon.s9api.XdmItem) Test(org.junit.Test)

Example 2 with XQueryEvaluator

use of org.sirix.saxon.evaluator.XQueryEvaluator in project sirix by sirixdb.

the class TestNodeWrapperS9ApiXQuery method testOrderByBooks.

@Test
public void testOrderByBooks() throws Exception {
    final XdmValue value = new XQueryEvaluator("for $x in /bookstore/book where $x/price>30 order by $x/title return $x/title", mHolder.getSession()).call();
    final StringBuilder strBuilder = new StringBuilder();
    for (final XdmItem item : value) {
        strBuilder.append(item.toString());
    }
    assertEquals("<title lang=\"en\">Learning XML</title><title lang=\"en\">XQuery Kick Start</title>", strBuilder.toString());
}
Also used : XdmValue(net.sf.saxon.s9api.XdmValue) XQueryEvaluator(org.sirix.saxon.evaluator.XQueryEvaluator) XdmItem(net.sf.saxon.s9api.XdmItem) Test(org.junit.Test)

Example 3 with XQueryEvaluator

use of org.sirix.saxon.evaluator.XQueryEvaluator in project sirix by sirixdb.

the class TestNodeWrapperS9ApiXQuery method testFLOWR.

@Test
public void testFLOWR() throws Exception {
    final XdmValue value = new XQueryEvaluator("for $x in /bookstore/book let $y := $x/price where $y>30 order by $x/title return $x/title", mHolder.getSession()).call();
    final StringBuilder strBuilder = new StringBuilder();
    for (final XdmItem item : value) {
        strBuilder.append(item.toString());
    }
    assertEquals("<title lang=\"en\">Learning XML</title><title lang=\"en\">XQuery Kick Start</title>", strBuilder.toString());
}
Also used : XdmValue(net.sf.saxon.s9api.XdmValue) XQueryEvaluator(org.sirix.saxon.evaluator.XQueryEvaluator) XdmItem(net.sf.saxon.s9api.XdmItem) Test(org.junit.Test)

Aggregations

XdmItem (net.sf.saxon.s9api.XdmItem)3 XdmValue (net.sf.saxon.s9api.XdmValue)3 Test (org.junit.Test)3 XQueryEvaluator (org.sirix.saxon.evaluator.XQueryEvaluator)3