Search in sources :

Example 31 with NodeId

use of org.apache.jena.tdb2.store.NodeId in project jena by apache.

the class DataToTuples method nodes.

private static Tuple<NodeId> nodes(NodeTable nt, Quad quad) {
    NodeId g = idForNode(nt, quad.getGraph());
    NodeId s = idForNode(nt, quad.getSubject());
    NodeId p = idForNode(nt, quad.getPredicate());
    NodeId o = idForNode(nt, quad.getObject());
    return TupleFactory.tuple(g, s, p, o);
}
Also used : NodeId(org.apache.jena.tdb2.store.NodeId)

Example 32 with NodeId

use of org.apache.jena.tdb2.store.NodeId in project jena by apache.

the class DataToTuples method nodes.

private static Tuple<NodeId> nodes(NodeTable nt, Triple triple) {
    NodeId s = idForNode(nt, triple.getSubject());
    NodeId p = idForNode(nt, triple.getPredicate());
    NodeId o = idForNode(nt, triple.getObject());
    return TupleFactory.tuple(s, p, o);
}
Also used : NodeId(org.apache.jena.tdb2.store.NodeId)

Example 33 with NodeId

use of org.apache.jena.tdb2.store.NodeId in project jena by apache.

the class DataToTuplesInlineSingle method nodes.

private static Tuple<NodeId> nodes(NodeTable nt, Quad quad) {
    NodeId g = idForNode(nt, quad.getGraph());
    NodeId s = idForNode(nt, quad.getSubject());
    NodeId p = idForNode(nt, quad.getPredicate());
    NodeId o = idForNode(nt, quad.getObject());
    return TupleFactory.tuple(g, s, p, o);
}
Also used : NodeId(org.apache.jena.tdb2.store.NodeId)

Example 34 with NodeId

use of org.apache.jena.tdb2.store.NodeId in project jena by apache.

the class TupleLib method tuple.

// ---- Tuples and Records
public static Tuple<NodeId> tuple(Record r, TupleMap tMap) {
    // Unmapping.
    int N = r.getKey().length / NodeId.SIZE;
    NodeId[] nodeIds = new NodeId[N];
    for (int i = 0; i < N; i++) {
        int j = i;
        if (tMap != null)
            j = tMap.unmapIdx(i);
        NodeId id = NodeIdFactory.get(r.getKey(), j * NodeId.SIZE);
        nodeIds[i] = id;
    }
    return TupleFactory.create(nodeIds);
}
Also used : NodeId(org.apache.jena.tdb2.store.NodeId)

Example 35 with NodeId

use of org.apache.jena.tdb2.store.NodeId in project jena by apache.

the class OpExecutorTDB2 method execute.

@Override
protected QueryIterator execute(OpDatasetNames dsNames, QueryIterator input) {
    DatasetGraphTDB ds = (DatasetGraphTDB) execCxt.getDataset();
    Predicate<Tuple<NodeId>> filter = QC2.getFilter(execCxt.getContext());
    Node gn = dsNames.getGraphNode();
    if (Var.isVar(gn))
        return SolverLibTDB.graphNames(ds, dsNames.getGraphNode(), input, filter, execCxt);
    else
        return SolverLibTDB.testForGraphName(ds, dsNames.getGraphNode(), input, filter, execCxt);
}
Also used : Node(org.apache.jena.graph.Node) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) DatasetGraphTDB(org.apache.jena.tdb2.store.DatasetGraphTDB)

Aggregations

NodeId (org.apache.jena.tdb2.store.NodeId)47 Node (org.apache.jena.graph.Node)24 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)16 TDBException (org.apache.jena.tdb2.TDBException)12 NodeTable (org.apache.jena.tdb2.store.nodetable.NodeTable)11 Quad (org.apache.jena.sparql.core.Quad)7 ArrayList (java.util.ArrayList)6 Var (org.apache.jena.sparql.core.Var)6 Triple (org.apache.jena.graph.Triple)5 NodeTupleTable (org.apache.jena.tdb2.store.nodetupletable.NodeTupleTable)5 Iterator (java.util.Iterator)4 Binding (org.apache.jena.sparql.engine.binding.Binding)4 StatsCollectorNodeId (org.apache.jena.tdb2.solver.stats.StatsCollectorNodeId)4 Predicate (java.util.function.Predicate)3 Iter (org.apache.jena.atlas.iterator.Iter)3 Record (org.apache.jena.dboe.base.record.Record)3 TupleIndex (org.apache.jena.tdb2.store.tupletable.TupleIndex)3 Test (org.junit.Test)3 List (java.util.List)2 Function (java.util.function.Function)2