Search in sources :

Example 21 with ResultSetRewindable

use of org.apache.jena.query.ResultSetRewindable in project Info-Evaluation by TechnionYP5777.

the class SqlTablesFiller method fillBasicInfoTable.

public void fillBasicInfoTable() throws SQLException, ParseException, ClassNotFoundException, IOException {
    connector.clearBasicInfoTable();
    Extractor ext = new Extractor();
    ext.executeQuery(QueryTypes.BASIC_INFO);
    ResultSetRewindable results = ext.getResults();
    results.reset();
    for (int i = 0; i < results.size(); ++i) fillBasicInfoTable(results);
}
Also used : ResultSetRewindable(org.apache.jena.query.ResultSetRewindable)

Example 22 with ResultSetRewindable

use of org.apache.jena.query.ResultSetRewindable in project jena by apache.

the class TestResultSet method test_RS_peeking_7.

@Test
public void test_RS_peeking_7() {
    // Peeking may fail if someone moves backwards in the result set
    // If we hadn't moved pass the first item this should be safe
    ResultSetRewindable inner = makeRewindable("x", NodeFactory.createURI("tag:local"));
    ResultSetPeekable rs = ResultSetFactory.makePeekable(inner);
    assertTrue(rs.hasNext());
    assertNotNull(rs.peek());
    // Reset the inner result set independently
    inner.reset();
    // Since we moved the underlying result set backwards but we hadn't gone anywhere
    // we should still be able to safely access the underlying results
    assertTrue(rs.hasNext());
}
Also used : ResultSetRewindable(org.apache.jena.query.ResultSetRewindable) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 23 with ResultSetRewindable

use of org.apache.jena.query.ResultSetRewindable in project jena by apache.

the class TestResultSet method make2Rewindable.

private ResultSetRewindable make2Rewindable(String var, Node val) {
    ResultSet rs = make2(var, val);
    ResultSetRewindable rsw = ResultSetFactory.makeRewindable(rs);
    return rsw;
}
Also used : BuilderResultSet(org.apache.jena.sparql.sse.builders.BuilderResultSet) ResultSet(org.apache.jena.query.ResultSet) ResultSetRewindable(org.apache.jena.query.ResultSetRewindable)

Example 24 with ResultSetRewindable

use of org.apache.jena.query.ResultSetRewindable in project jena by apache.

the class TestResultSet method test_RS_1_str.

@Test
public void test_RS_1_str() {
    ResultSetRewindable rs1 = new ResultSetMem();
    String x = ResultSetFormatter.asXMLString(rs1);
    rs1.reset();
    ResultSet rs2 = ResultSetFactory.fromXML(x);
    assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2));
}
Also used : BuilderResultSet(org.apache.jena.sparql.sse.builders.BuilderResultSet) ResultSet(org.apache.jena.query.ResultSet) ResultSetRewindable(org.apache.jena.query.ResultSetRewindable) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 25 with ResultSetRewindable

use of org.apache.jena.query.ResultSetRewindable in project jena by apache.

the class TestResultSet method test_RS_cmp_1.

// Test comparison 
@Test
public void test_RS_cmp_1() {
    ResultSetRewindable rs1 = new ResultSetMem();
    ResultSetRewindable rs2 = new ResultSetMem();
    assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2));
    rs1.reset();
    rs2.reset();
    assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2));
}
Also used : ResultSetRewindable(org.apache.jena.query.ResultSetRewindable) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Aggregations

ResultSetRewindable (org.apache.jena.query.ResultSetRewindable)32 Test (org.junit.Test)18 BaseTest (org.apache.jena.atlas.junit.BaseTest)17 ResultSet (org.apache.jena.query.ResultSet)11 BuilderResultSet (org.apache.jena.sparql.sse.builders.BuilderResultSet)11 ByteArrayInputStream (java.io.ByteArrayInputStream)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 QuerySolution (org.apache.jena.query.QuerySolution)5 Extractor (infoeval.main.WikiData.Extractor)3 RDFNode (org.apache.jena.rdf.model.RDFNode)3 Model (org.apache.jena.rdf.model.Model)2 SqlTablesFiller (infoeval.main.WikiData.SqlTablesFiller)1 Date (java.sql.Date)1 ArrayList (java.util.ArrayList)1 Item (org.apache.jena.sparql.sse.Item)1 Ignore (org.junit.Ignore)1