ConstraintBuilder where = builder.where();
List<StepExpression> path = new ArrayList<StepExpression>();
String tableName = null;
for (StepExpression step : steps) {
if (step instanceof AxisStep) {
AxisStep axis = (AxisStep)step;
NodeTest nodeTest = axis.getNodeTest();
if (nodeTest instanceof NameTest) {
if (appliesToPathConstraint(axis.getPredicates())) {
// Everything in this axis/step applies to the path, so add it and we'll translate it below ...
path.add(step);
} else {
// The constraints are more complicated than can be applied to the path ...
// if (!nameTest.isWildcard()) {
// There is a non-wildcard name test that we still need to add to the path ...
path.add(step);
// }
// We need to define a new source/table ...
tableName = translateSource(tableName, path, where);
translatePredicates(axis.getPredicates(), tableName, where);
path.clear();
}
} else if (nodeTest instanceof ElementTest) {
// We need to build a new source with the partial path we have so far ...
tableName = translateElementTest((ElementTest)nodeTest, path, where);
translatePredicates(axis.getPredicates(), tableName, where);
path.clear();
} else if (nodeTest instanceof AttributeNameTest) {
AttributeNameTest attributeName = (AttributeNameTest)nodeTest;
builder.select(nameFrom(attributeName.getNameTest()));
} else {