DatavaluedPropertyAtom pattern1 = new DatavaluedPropertyAtom(dp2, x, z);
DatavaluedPropertyAtom pattern2 = new DatavaluedPropertyAtom(dp2, y, z);
BindingHelper genHelper1 = new DatavaluePropertyBindingHelper(kb.getABox(), pattern1);
BindingHelper genHelper2 = new DatavaluePropertyBindingHelper(kb.getABox(), pattern2);
BindingGenerator gen = new BindingGeneratorImpl(kb.getABox(), new VariableBinding(kb.getABox()), Arrays
.asList(new BindingHelper[] { genHelper1, genHelper2 }));
List<VariableBinding> expected = new LinkedList<VariableBinding>();
VariableBinding binding;
ATermAppl[] names = new ATermAppl[] { mary, robert, victor };
ATermAppl[] values = new ATermAppl[] { data1, data2, data3, data4 };
for (ATermAppl xName : names) {
for (ATermAppl yName : names) {
for (ATermAppl zValue : values) {
Individual xNode = kb.getABox().getIndividual(xName);
Individual yNode = kb.getABox().getIndividual(yName);
Literal zNode = kb.getABox().addLiteral(zValue);
if (kb.hasPropertyValue(xName, dp2, zValue) && kb.hasPropertyValue(yName, dp2, zValue)) {
binding = new VariableBinding(kb.getABox());
binding.set(x, xNode);
binding.set(y, yNode);
binding.set(z, zNode);
expected.add(binding);
}
}
}
}
assertIteratorValues(gen.iterator(), expected.iterator());
}