This paper formalizes the notion of a design model structurally conforming to a design pattern by representing the model as a logic program whilst the pattern as a query. The conformance of a model to a design pattern is equivalent to the satisfaction of the query by the logic program. Harnessing logic inference capability of logic programming languages, we obtain an automated method that infers all the instances of a design pattern in a UML class diagram. We use the Visitor pattern and a price calculation application to demonstrate the technique.