Full implementation of the Semantic Web requires widespread availability of OWL ontologies. Manual ontology development using current OWL editors remains a tedious and cumbersome task that requires significant understanding of the new ontology language and can easily result in a knowledge acquisition bottleneck. On the other hand, abundant domain knowledge has been specified by existing database schemata such as UML class diagrams. Thus developing an automatic tool for extracting OWL ontologies from existing UML class diagrams is helpful to Web ontology development. In this paper we propose an automatic, semantics-preserving approach for extracting OWL ontologies from existing UML class diagrams. This approach establishes a precise conceptual correspondence between UML and OWL through a semantics-preserving schema translation algorithm. The experiments with our implemented prototype tool, UML2OWL, show that the proposed approach is effective and a fully automatic ontology extraction is achievable. The proposed approach and tool will facilitate the development of Web ontologies and the realization of semantic interoperations between existing Web database applications and the Semantic Web.