use of org.apache.jena.sparql.algebra.op.OpTable in project jena by apache.
the class TestTable method table_02.
// JENA-1468: Table, no rows , with declared variables.
@Test
public void table_02() {
Table table = TableFactory.create();
table.getVars().add(Var.alloc("a"));
Op opTable = OpTable.create(table);
String x = str(opTable);
assertEquals("(table (vars ?a))", x);
}
use of org.apache.jena.sparql.algebra.op.OpTable in project jena by apache.
the class TestTable method table_03.
@Test
public void table_03() {
Table table = TableFactory.create();
Binding b = BindingFactory.empty();
table.addBinding(b);
Op opTable = OpTable.create(table);
String x = str(opTable);
assertEquals("(table (vars) (row) )", x);
}
use of org.apache.jena.sparql.algebra.op.OpTable in project jena by apache.
the class OpRewriter method visit.
@Override
public void visit(OpTable opTable) {
Table tbl = opTable.getTable();
boolean process = false;
for (Var v : tbl.getVars()) {
process = process | values.keySet().contains(v);
}
if (!process) {
push(opTable);
} else {
TableN retTbl = new TableN(tbl.getVars());
Iterator<Binding> iter = tbl.rows();
while (iter.hasNext()) {
retTbl.addBinding(rewrite(iter.next()));
}
push(OpTable.create(retTbl));
}
}
use of org.apache.jena.sparql.algebra.op.OpTable in project jena by apache.
the class TestTransformFilters method nested_02.
@Test
public void nested_02() {
Transform tableChanger = new TransformCopy() {
@Override
public Op transform(OpTable opTable) {
// Always a new object
return OpTable.create(opTable.getTable());
}
};
testOp("(filter (?A) (filter (?B) (table unit)))", tableChanger, "(filter (exprlist ?B ?A) (table unit))");
}
use of org.apache.jena.sparql.algebra.op.OpTable in project jena by apache.
the class TestTable method table_01.
@Test
public void table_01() {
Table table = TableFactory.createEmpty();
Op opTable = OpTable.create(table);
String x = str(opTable);
assertEquals("(table empty)", x);
}
Aggregations