It appears that the need exists to find a "formula" which "matches" as specific set of "traits". And it appears that the possibility exists that any given set(A) might have a subset(B) which also has a formula. However set A, being more specific, should take precedence (presumably) over the formula for B.
I don't understand why you think a B-tree provides a solution to any of that. B-trees don't solve formulas or more/less specific bindings.
Thus one needs to find a match for the elements in A and failing that then find the match for B.
You've been asked twice how B-trees solve any of that, and you haven't answered, other than by reiterating the terms of the problem.
A B-tree might be an appropriate
data structure for the problem, although I don't see why, and none of your handwaving tells me. But then so would the HashMap the OP is already using, and many others. And most of the OP's problem is still sitting there waiting for it to be solved. Or else you're attributing magical properties to B-trees that they do not have. And there are no B-tree implementations in the JDK.
Feel free to suggest an alternative solution to the above
I had already done so.