Multiple-viewed requirements modeling allows requirement engineers to acquire the requirements of a system from different perspectives. Requirements are then specified in various UML models. Maintaining the requirements knowledge encoded in UML notations is tedious and error-prone, since most UML CASE tools provide poor support for reasoning and query. Ontology is a formal notation for describing concepts and their relations in a domain. Since requirement is a kind of knowledge, we propose to use knowledge engineering approach for managing the consistency and completeness of UML models. In this paper, an ontology for UML diagrams is coded in a semantic web language, OWL (Web Ontology Language). The transformation of UML Class Diagram, Sequence Diagram and State Diagram to OWL knowledge base is presented. In the end, a semantic query language, SPARQL, is used to query the knowledge base. We demonstrate the feasibility of this approach through an example software system.