use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class ExQuadFilter method createFilter.
/** Create a filter to exclude the graph http://example/g2 */
private static Filter<Tuple<NodeId>> createFilter(Dataset ds) {
// Filtering operates at a very low level:
// Need to know the internal identifier for the graph name.
final NodeId target = TDBInternal.getNodeId(ds, NodeFactory.createURI(graphToHide));
System.out.println("Hide graph: " + graphToHide + " --> " + target);
// Filter for accept/reject as quad as being visible.
// Return true for "accept", false for "reject"
Filter<Tuple<NodeId>> filter = new Filter<Tuple<NodeId>>() {
@Override
public boolean accept(Tuple<NodeId> item) {
//System.err.println(item) ;
if (item.size() == 4 && item.get(0).equals(target)) {
//System.out.println("Reject: "+item) ;
return false;
}
//System.out.println("Accept: "+item) ;
return true;
}
};
return filter;
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class BindingNodeId method toString.
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
boolean first = true;
for (Var v : this) {
if (!first)
sb.append(" ");
first = false;
NodeId x = get(v);
sb.append(v);
sb.append(" = ");
sb.append(x);
}
return sb.toString();
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class BindingTDB method format.
@Override
protected void format(StringBuffer sbuff, Var var) {
NodeId id = idBinding.get(var);
String extra = "";
if (id != null)
extra = "/" + id;
Node node = get(var);
String tmp = NodeFmtLib.displayStr(node);
sbuff.append("( ?" + var.getVarName() + extra + " = " + tmp + " )");
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class DumpOps method dumpNodeTable.
public static void dumpNodeTable(NodeTable nodeTable, Set<NodeTable> dumpedNodeTables) {
if (dumpedNodeTables.contains(nodeTable))
return;
Iterator<Pair<NodeId, Node>> iter = nodeTable.all();
for (; iter.hasNext(); ) {
Pair<NodeId, Node> pair = iter.next();
NodeId nid = pair.car();
Node n = pair.cdr();
String x = NodeFmtLib.displayStr(n);
System.out.printf("%016X %s\n", nid.getId(), x);
}
dumpedNodeTables.add(nodeTable);
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class TupleLib method tuple.
// ---- Tuples and Records
public static Tuple<NodeId> tuple(Record r, ColumnMap cMap) {
int N = r.getKey().length / SizeOfLong;
NodeId[] nodeIds = new NodeId[N];
for (int i = 0; i < N; i++) {
NodeId id = NodeId.create(r.getKey(), i * SizeOfLong);
int j = i;
if (cMap != null)
j = cMap.fetchSlotIdx(i);
nodeIds[j] = id;
}
return TupleFactory.asTuple(nodeIds);
}
Aggregations