Bidirectional Structural Mapping Models for Constructing Rule-based Systems