Search in sources :

Example 71 with Item

use of org.apache.jena.sparql.sse.Item in project jena by apache.

the class ResultSetFactory method fromSSE.

/**
     * Read from an input stream which is the format of the SPARQL result set
     * format in SSE.
     * 
     * @param in
     *            InputStream
     * @return ResultSet
     */
public static ResultSet fromSSE(InputStream in) {
    Item item = SSE.parse(in);
    Log.warn(ResultSet.class, "Reading SSE result set not full implemented");
    // See SPARQLResult. Have a level of ResultSetFactory that does
    // "get SPARQLResult".
    // Or just boolean/result set because those are both srx. etc.
    BuilderTable.build(item);
    return null;
}
Also used : Item(org.apache.jena.sparql.sse.Item)

Example 72 with Item

use of org.apache.jena.sparql.sse.Item in project jena by apache.

the class TestPath method parse.

private void parse(String string, boolean expectLegal) {
    Prologue prologue = new Prologue(pmap);
    Path p = null;
    try {
        p = PathParser.parse(string, prologue);
        //            System.out.println(PathWriterSSE.asString(p, new Prologue(pmap))) ;
        if (!expectLegal)
            fail("Expected error; " + string);
    } catch (QueryParseException ex) {
        if (expectLegal)
            fail("Expected success: " + string + ": " + ex.getMessage());
        return;
    }
    String x = p.toString(prologue);
    Path p2 = PathParser.parse(x, prologue);
    assertEquals(p, p2);
    String sse = WriterPath.asString(p, prologue);
    Item item = SSE.parseItem(sse, pmap);
    p2 = BuilderPath.buildPath(item);
    assertEquals(p, p2);
}
Also used : WriterPath(org.apache.jena.sparql.sse.writers.WriterPath) BuilderPath(org.apache.jena.sparql.sse.builders.BuilderPath) Item(org.apache.jena.sparql.sse.Item) Prologue(org.apache.jena.sparql.core.Prologue) QueryParseException(org.apache.jena.query.QueryParseException)

Example 73 with Item

use of org.apache.jena.sparql.sse.Item in project jena by apache.

the class TestSolverLib method matcher.

//    private static StatsMatcher matcher(String str)
//    {
//        String s1 = "(prefix ((: <http://example/>))\n(stats " ;
//        String s2 = "))" ;
//        Item item = SSE.parse(s1+str+s2) ;
//        return new StatsMatcher(item) ; 
//    }
//    
public static StatsMatcher matcher(String... str) {
    String s1 = "(prefix ((: <http://example/>))\n(stats ";
    String s2 = "))";
    String x = StrUtils.strjoinNL(str);
    Item item = SSE.parse(s1 + x + s2);
    return new StatsMatcher(item);
}
Also used : Item(org.apache.jena.sparql.sse.Item) StatsMatcher(org.apache.jena.sparql.engine.optimizer.StatsMatcher)

Example 74 with Item

use of org.apache.jena.sparql.sse.Item in project jena by apache.

the class TestSSE_Basic method testNum_01.

@Test
public void testNum_01() {
    Item item = SSE.parse("1");
    assertEquals(1, item.getInt());
}
Also used : Item(org.apache.jena.sparql.sse.Item) Test(org.junit.Test)

Example 75 with Item

use of org.apache.jena.sparql.sse.Item in project jena by apache.

the class TestSSE_Basic method testTaggedList_1.

@Test
public void testTaggedList_1() {
    Item x = Item.createTagged("TAG");
    assertTrue(x.isTagged());
    assertTrue(x.isTagged("TAG"));
}
Also used : Item(org.apache.jena.sparql.sse.Item) Test(org.junit.Test)

Aggregations

Item (org.apache.jena.sparql.sse.Item)78 Test (org.junit.Test)31 Node (org.apache.jena.graph.Node)11 ItemList (org.apache.jena.sparql.sse.ItemList)10 Var (org.apache.jena.sparql.core.Var)6 ArrayList (java.util.ArrayList)5 Binding (org.apache.jena.sparql.engine.binding.Binding)3 Graph (org.apache.jena.graph.Graph)2 Triple (org.apache.jena.graph.Triple)2 ARQException (org.apache.jena.sparql.ARQException)2 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)2 VarExprList (org.apache.jena.sparql.core.VarExprList)2 ItemException (org.apache.jena.sparql.sse.ItemException)2 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)1 RDFDatatype (org.apache.jena.datatypes.RDFDatatype)1 QueryParseException (org.apache.jena.query.QueryParseException)1 ResultSetRewindable (org.apache.jena.query.ResultSetRewindable)1 Model (org.apache.jena.rdf.model.Model)1 ARQInternalErrorException (org.apache.jena.sparql.ARQInternalErrorException)1 Table (org.apache.jena.sparql.algebra.Table)1