Legal reasoning by structural analogy based on goal dependent abstraction