for (final Bindings oldBinding : oldBindings) {
// Triple triple = getTriple();
final Bindings bindings = this.bindingsFactory.createInstance();
Literal literal = null;
for (int i = 0; i < this.filterLeft.size(); i++) {
// its value has to be equal to the corresponding value of
// the triple pattern
if (!this.filterLeft.get(i).getLiteral(null).valueEquals(
oldBinding.get(this.filterRight.get(i)))) {
return null;
}
}
// process all items
// for(int i = 0; i < 3; i++){
for (int i = 0; i < this.substitutionsLiteralLeft.size(); i++) {
// if the item is an unbound variable
final Variable item = this.substitutionsLiteralLeft.get(i);
if ((literal = bindings.get(item)) == null) {
bindings.add(item, this.substitutionsLiteralRight.get(i));
}
// if the item is a variable which is already bound
// and the value differs from the value of the triple
// which would be used as binding, a conflict was
// detected
else if (!literal.valueEquals(this.substitutionsLiteralRight.get(i))) {
return null; // join within triple pattern!
}
}
for (int i = 0; i < this.substitutionsVariableLeft.size(); i++) {
// if the item is an unbound variable
final Variable item = this.substitutionsVariableLeft.get(i);
if ((literal = bindings.get(item)) == null) {
bindings.add(item, oldBinding
.get(this.substitutionsVariableRight.get(i)));
}
// if the item is a variable which is already bound
// and the value differs from the value of the triple
// which would be used as binding, a conflict was
// detected
else if (!literal.valueEquals(oldBinding
.get(this.substitutionsVariableRight.get(i)))) {
return null; // join within triple pattern!
}
}