marklogic / marklogic-jena

Adapter for using MarkLogic with the Jena RDF Framework
Other
5 stars 11 forks source link

Limit not cleared after query execution #6

Closed kkanthet closed 9 years ago

kkanthet commented 9 years ago

Once the limit is set for a query , its not cleared after query execution.

    Query query = QueryFactory.create("PREFIX  bb: <http://marklogic.com/baseball/players#>  SELECT ?o  WHERE"
                + "{ ?s bb:position ?o.}");

        // Query with limit 2
        query.setLimit(2);
        QueryExecution queryExec = QueryExecutionFactory.create(query, dataSet);

        ResultSet results = queryExec.execSelect();
        assertNotNull(results);
        assertTrue(results.hasNext());
        int count = 0;
        while (results.hasNext()) {
            QuerySolution qs = results.next();
            System.out.println(qs.toString());
            assertTrue(qs.contains("o"));
            count++;
        }
        assertTrue(count == 2);

        // Query with Offset 2
        query.setOffset(2);
        System.out.println(query.getLimit());   
        queryExec = QueryExecutionFactory.create(query, dataSet);
        results = queryExec.execSelect();
        assertNotNull(results);
        assertTrue(results.hasNext());
        count = 0;
        while (results.hasNext()) {
            QuerySolution qs = results.next();
            System.out.println(qs.toString());
            assertTrue(qs.contains("o"));
            count++;
        }
        //TODO confirm LIMIT reset to the query
        assertTrue("Should return 9 results but returned::"+count,count == 9);
grechaw commented 9 years ago

I verified and found where to fix this bug. The queryManager needs to have its pagelength cleared if none is supplied in a select.

grechaw commented 9 years ago

This is pushed to develop

kkanthet commented 9 years ago

Verified the limit is cleared when not set.