use of org.apache.jena.sparql.algebra.Table in project jena by apache.
the class TableBase method equals.
@Override
public boolean equals(Object other) {
if (this == other)
return true;
if (!(other instanceof Table))
return false;
Table table = (Table) other;
if (table.size() != this.size())
return false;
QueryIterator qIter1 = iterator(null);
QueryIterator qIter2 = table.iterator(null);
try {
for (; qIter1.hasNext(); ) {
Binding bind1 = qIter1.nextBinding();
Binding bind2 = qIter2.nextBinding();
if (!BindingBase.equals(bind1, bind2))
return false;
}
return true;
} finally {
qIter1.close();
qIter2.close();
}
}
use of org.apache.jena.sparql.algebra.Table in project jena by apache.
the class AbstractTestJoin method executeTestJoin.
protected void executeTestJoin(String msg, JoinKey joinKey, Table left, Table right, ExprList conditions, Table expectedResults) {
Table x1 = joinMaterialize(joinKey, left, right, conditions);
assertNotNull("Null table from join (" + msg + ")", x1);
if (false)
print(msg, joinKey, left, right, conditions, expectedResults, x1);
check("Results not equal (" + msg + ")", joinKey, left, right, conditions, expectedResults, x1);
}
use of org.apache.jena.sparql.algebra.Table in project jena by apache.
the class AbstractTestLeftJoin method leftjoin_condition_02.
@Test
public void leftjoin_condition_02() {
Table tableD3_LJc = parseTableInt("(table", " (row (?d 8) (?a 0))", " (row (?a 1) (?c 9) (?b 2))", " (row (?a 1) (?c 9) (?b 2))", ")");
testJoin("a", tableD2(), tableD1(), "((= ?a 1) (= ?b 2))", tableD3_LJc);
}
use of org.apache.jena.sparql.algebra.Table in project jena by apache.
the class AbstractTestLeftJoin method leftjoin_condition_01.
// Conditions.
@Test
public void leftjoin_condition_01() {
Table tableD1c = parseTableInt("(table", " (row (?a 1) (?b 3))", ")");
testJoin("a", table1(), tableD1(), "((= ?b 3))", tableD1c);
}
use of org.apache.jena.sparql.algebra.Table 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));
}
}
Aggregations