Package com.hp.hpl.jena.query

Examples of com.hp.hpl.jena.query.QueryExecution.execSelect()


    public void timeout_06()
    {
        String qs = prefix + "SELECT * { ?s ?p ?o FILTER f:wait(1) }" ; // Sleep in execution to kick timer thread.
        QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
        qExec.setTimeout(100, TimeUnit.MILLISECONDS) ;
        ResultSet rs = qExec.execSelect() ;
        ResultSetFormatter.consume(rs) ;
        qExec.close() ;
    }
   
    @Test
View Full Code Here


    public void timeout_07()
    {
        // No timeout.
        String qs = prefix + "SELECT * { ?s ?p ?o FILTER f:wait(1) }" ;
        QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
        ResultSet rs = qExec.execSelect() ;
        ResultSetFormatter.consume(rs) ;
        qExec.close() ;
    }

    @Test
View Full Code Here

    {
        // No timeout.
        String qs = prefix + "SELECT * { ?s ?p ?o FILTER f:wait(1) }" ;
        QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
        qExec.setTimeout(-1, TimeUnit.MILLISECONDS) ;
        ResultSet rs = qExec.execSelect() ;
        ResultSetFormatter.consume(rs) ;
        qExec.close() ;
    }

    @Test
View Full Code Here

    public void timeout_09()
    {
        String qs = prefix + "SELECT * { ?s ?p ?o }" ;
        QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
        qExec.setTimeout(500, TimeUnit.MILLISECONDS, -1, TimeUnit.MILLISECONDS) ;
        ResultSet rs = qExec.execSelect() ;
        rs.next() ; // First timeout does not go off. Resets timers.
        rs.next() ; // Second timeout never goes off
        assertTrue(rs.hasNext()) ;
        ResultSetFormatter.consume(rs) ; // Second timeout does not go off.
        qExec.close() ;
View Full Code Here

    public void timeout_10()
    {
        String qs = prefix + "SELECT * { ?s ?p ?o }" ;
        QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
        qExec.setTimeout(100, TimeUnit.MILLISECONDS, 100, TimeUnit.MILLISECONDS) ;
        ResultSet rs = qExec.execSelect() ;
        rs.next() ; // First timeout does not go off. Resets timers.
        rs.next() ; // Second timeout never goes off
        assertTrue(rs.hasNext()) ;
        sleep(200) ;
        exceptionExpected(rs) ;
View Full Code Here

    public void timeout_11()
    {
        String qs = prefix + "SELECT * { ?s ?p ?o }" ;
        QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
        qExec.setTimeout(-1, TimeUnit.MILLISECONDS, 100, TimeUnit.MILLISECONDS) ;
        ResultSet rs = qExec.execSelect() ;
        rs.next() ; // First timeout does not go off. Resets timer.
        rs.next() ; // Second timeout does not go off
        sleep(200) ;
        exceptionExpected(rs) ;
        qExec.close() ;
View Full Code Here

    public void timeout_20()
    {
        String qs = prefix + "SELECT * { ?s ?p ?o }" ;
        ARQ.getContext().set(ARQ.queryTimeout, "20") ;
        QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
        ResultSet rs = qExec.execSelect() ;
        sleep(50) ;
        exceptionExpected(rs) ;
    }
   
    @Test
View Full Code Here

    public void timeout_21()
    {
        String qs = prefix + "SELECT * { ?s ?p ?o }" ;
        ARQ.getContext().set(ARQ.queryTimeout, "20,10") ;
        QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
        ResultSet rs = qExec.execSelect() ;
        sleep(50) ;
        exceptionExpected(rs) ;
    }

    @Test
View Full Code Here

    public void timeout_22()
    {
        String qs = prefix + "SELECT * { ?s ?p ?o }" ;
        ARQ.getContext().set(ARQ.queryTimeout, "-1") ;
        QueryExecution qExec = QueryExecutionFactory.create(qs, ds) ;
        ResultSet rs = qExec.execSelect() ;
        ResultSetFormatter.consume(rs) ;
        qExec.close() ;
    }

    private static void exceptionExpected(ResultSet rs)
View Full Code Here

    private ResultSetRewindable executeSparqlSelect(Model model, String sparql, boolean lock) {
        Query query = QueryFactory.create(sparql);
        QueryExecution queryExec = QueryExecutionFactory.create(query, model);
        model.enterCriticalSection(lock);
        try {
            return ResultSetFactory.makeRewindable(queryExec.execSelect());
        } finally {
            queryExec.close();
            model.leaveCriticalSection();
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.