Search in sources :

Example 46 with Item

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

the class Stats method format.

private static Item format(Map<Node, Integer> predicates, Map<Node, Integer> types, long count) {
    Item stats = Item.createList();
    ItemList statsList = stats.getList();
    statsList.add("stats");
    Item meta = createTagged(StatsMatcher.META);
    addPair(meta.getList(), "timestamp", NodeFactoryExtra.nowAsDateTime());
    addPair(meta.getList(), "run@", DateTimeUtils.nowAsString());
    if (count >= 0)
        addPair(meta.getList(), StatsMatcher.COUNT, NodeFactoryExtra.intToNode((int) count));
    statsList.add(meta);
    for (Entry<Node, Integer> entry : types.entrySet()) {
        Node type = entry.getKey();
        addTypeTriple(statsList, type, NodeFactoryExtra.intToNode(entry.getValue()));
    }
    for (Entry<Node, Integer> entry : predicates.entrySet()) {
        Node node = entry.getKey();
        // Skip these - they just clog things up!
        if (node.getURI().startsWith("http://www.w3.org/1999/02/22-rdf-syntax-ns#_"))
            continue;
        addPair(statsList, node, NodeFactoryExtra.intToNode(entry.getValue()));
    }
    // Add a default rule.
    addPair(statsList, StatsMatcher.OTHER, ZERO);
    return stats;
}
Also used : Item(org.apache.jena.sparql.sse.Item) ItemList(org.apache.jena.sparql.sse.ItemList) Node(org.apache.jena.graph.Node)

Example 47 with Item

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

the class TestConcurrentAccess method buildGraph.

private static Graph buildGraph() {
    Item item = SSE.parse(data);
    Graph g = BuilderGraph.buildGraph(item);
    return g;
}
Also used : Item(org.apache.jena.sparql.sse.Item) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) BuilderGraph(org.apache.jena.sparql.sse.builders.BuilderGraph) Graph(org.apache.jena.graph.Graph)

Example 48 with Item

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

the class TestSSE_Forms method testPrefix_05.

@Test
public void testPrefix_05() {
    Item r = SSE.parse("(<http://example/abc>)", null);
    testItem("(prefix ((ex: <http://example/>)) ( (prefix ((x: <http://EXAMPLE/>)) ex:abc) ))", r);
}
Also used : Item(org.apache.jena.sparql.sse.Item) Test(org.junit.Test)

Example 49 with Item

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

the class TestSSE_Forms method testBase_06.

@Test
public void testBase_06() {
    Item r = SSE.parse("(<http://example/xyz> <http://EXAMPLE/other#foo>)", null);
    testItem("(base <http://example/> (<xyz> (base <http://EXAMPLE/other> <#foo>)))", r);
}
Also used : Item(org.apache.jena.sparql.sse.Item) Test(org.junit.Test)

Example 50 with Item

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

the class TestSSE_Forms method testBase_02.

@Test
public void testBase_02() {
    Item r = Item.createNode(NodeFactory.createURI("http://example/x"));
    testItem("(base <http://HOST/> (base <http://example/xyz> <x>))", r);
}
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