if (selectNode.getSelectors().size() != 1 || !selectNode.getSelectors().contains(selectorName)) return null;
Constraint constraint = selectNode.getProperty(Property.SELECT_CRITERIA, Constraint.class);
Set<Column> columns = getColumnsReferencedBy(constraint);
if (columns.size() != 1) return null;
Column column = columns.iterator().next();
if (!column.getSelectorName().equals(selectorName)) return null;
if (!column.getPropertyName().equals(propertyName)) return null;
// We know that this constraint ONLY applies to the referenced selector and property,
// so we will duplicate this constraint ...
// Create the new node ...
PlanNode copy = new PlanNode(Type.SELECT, copySelectorName);
// Copy the constraint, but change the references to the copy selector and property ...
PlanUtil.ColumnMapping mappings = new PlanUtil.ColumnMapping(selectorName);
mappings.map(propertyName, new Column(copySelectorName, copyPropertyName, copyPropertyName));
Constraint newCriteria = PlanUtil.replaceReferences(context, constraint, mappings, copy);
copy.setProperty(Property.SELECT_CRITERIA, newCriteria);
return copy;
}