Search in sources :

Example 31 with ResultSetRewindable

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

the class TestResultSet method test_RS_1.

// Test reading, writing and comparison
@Test
public void test_RS_1() {
    ResultSetRewindable rs1 = new ResultSetMem();
    ByteArrayOutputStream arr = new ByteArrayOutputStream();
    ResultSetFormatter.outputAsXML(arr, rs1);
    rs1.reset();
    ByteArrayInputStream ins = new ByteArrayInputStream(arr.toByteArray());
    ResultSet rs2 = ResultSetFactory.fromXML(ins);
    assertTrue(ResultSetCompare.equalsByTerm(rs1, rs2));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) BuilderResultSet(org.apache.jena.sparql.sse.builders.BuilderResultSet) ResultSet(org.apache.jena.query.ResultSet) ResultSetRewindable(org.apache.jena.query.ResultSetRewindable) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 32 with ResultSetRewindable

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

the class TestSolverTDB method same.

private static void same(ResultSet rs1, ResultSet rs2, boolean result) {
    ResultSetRewindable rsw1 = ResultSetFactory.makeRewindable(rs1);
    ResultSetRewindable rsw2 = ResultSetFactory.makeRewindable(rs2);
    boolean b = ResultSetCompare.equalsByValue(rsw1, rsw2);
    if (b != result) {
        System.out.println("Different: ");
        rsw1.reset();
        rsw2.reset();
        ResultSetFormatter.out(rsw1);
        ResultSetFormatter.out(rsw2);
        System.out.println();
    }
    assertTrue(b == result);
}
Also used : ResultSetRewindable(org.apache.jena.query.ResultSetRewindable)

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