String key = item.filter(attributes).toString();
if (!selectedItems.containsKey(key)) {
selectedItems.put(key, item);
} else {
ConstraintItem existingItem = selectedItems.get(key);
if (existingItem.match(item.getAttributes())) {
// item is more specific than existingItem
selectedItems.put(key, item);
} else if (!item.match(existingItem.getAttributes())) {
// existingItem and item are of incomparable specificity
int value = valueOf(item.getConstraintValue());