Search in sources :

Example 16 with ResultSet

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

the class TestSolverTDB method solve_03.

@Test
public void solve_03() {
    // Above everything.
    ResultSet rs1 = exec("(bgp (:zzzz :p 999999))", graph);
    ResultSet rs2 = results("empty");
    equals(rs1, rs2);
}
Also used : ResultSet(org.apache.jena.query.ResultSet) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test) ConfigTest(org.apache.jena.tdb.ConfigTest)

Example 17 with ResultSet

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

the class TestSolverTDB method solve_06.

@Test
public void solve_06() {
    ResultSet rs1 = exec("(bgp (:s ?p ?o))", graph);
    ResultSet rs2 = results("(row (?p :p) (?o :o))", "(row (?p :p) (?o 10))", "(row (?p :p) (?o :x))");
    equals(rs1, rs2);
}
Also used : ResultSet(org.apache.jena.query.ResultSet) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test) ConfigTest(org.apache.jena.tdb.ConfigTest)

Example 18 with ResultSet

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

the class TestResultSetThrift method test.

private static ResultSetRewindable test(ResultSetRewindable resultSet) {
    resultSet.reset();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    BinRDF.writeResultSet(out, resultSet, true);
    resultSet.reset();
    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    ResultSet rs$ = BinRDF.readResultSet(in);
    ResultSetRewindable resultSet2 = ResultSetFactory.makeRewindable(rs$);
    // Includes bnode labels. 
    ResultSetCompare.equalsExact(resultSet, resultSet2);
    resultSet.reset();
    resultSet2.reset();
    return resultSet2;
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) BuilderResultSet(org.apache.jena.sparql.sse.builders.BuilderResultSet) ResultSet(org.apache.jena.query.ResultSet) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ResultSetRewindable(org.apache.jena.query.ResultSetRewindable)

Example 19 with ResultSet

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

the class TestResultSetThrift method resultSet_10.

@Test
public void resultSet_10() {
    try (InputStream in = IO.openFile(DIR + "/results-1.srj")) {
        ResultSet rs = ResultSetFactory.fromJSON(in);
        test(ResultSetFactory.copyResults(rs));
    } catch (IOException ex) {
        IO.exception(ex);
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) BuilderResultSet(org.apache.jena.sparql.sse.builders.BuilderResultSet) ResultSet(org.apache.jena.query.ResultSet) IOException(java.io.IOException) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 20 with ResultSet

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

the class TestResultSet method make2Peekable.

private ResultSetPeekable make2Peekable(String var1, Node val1, String var2, Node val2) {
    ResultSet rs = make(var1, val1, var2, val2);
    ResultSetPeekable rsp = ResultSetFactory.makePeekable(rs);
    return rsp;
}
Also used : BuilderResultSet(org.apache.jena.sparql.sse.builders.BuilderResultSet) ResultSet(org.apache.jena.query.ResultSet)

Aggregations

ResultSet (org.apache.jena.query.ResultSet)79 Test (org.junit.Test)43 BuilderResultSet (org.apache.jena.sparql.sse.builders.BuilderResultSet)33 BaseTest (org.apache.jena.atlas.junit.BaseTest)27 QueryExecution (org.apache.jena.query.QueryExecution)18 QuerySolution (org.apache.jena.query.QuerySolution)15 ByteArrayInputStream (java.io.ByteArrayInputStream)13 Query (org.apache.jena.query.Query)11 ResultSetRewindable (org.apache.jena.query.ResultSetRewindable)11 ByteArrayOutputStream (java.io.ByteArrayOutputStream)10 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)8 ResultSetStream (org.apache.jena.sparql.engine.ResultSetStream)8 ArrayList (java.util.ArrayList)7 Node (org.apache.jena.graph.Node)7 Model (org.apache.jena.rdf.model.Model)6 ConfigTest (org.apache.jena.tdb.ConfigTest)6 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)5 Var (org.apache.jena.sparql.core.Var)5 NodeAlignment (mom.trd.opentheso.bdd.helper.nodes.NodeAlignment)4 Binding (org.apache.jena.sparql.engine.binding.Binding)4