Building service-based architectures has become a major area of interest since the advent of Web services. Modelling these architectures is a central activity. Model-driven architecture is a recent approach to developing software systems based on the idea of making models the central artifacts for design representation, analysis, and code generation. We propose an ontology-based composition and transformation approach for model-driven service architecting. Ontology technology as a logic-based knowledge representation and reasoning framework can provide answers to the needs of sharable and reusable models and descriptions needed for service engineering. Based on UML-style visual modelling of service architectures and their mapping into an ontology representation, our approach enables ontology-based semantic modelling based on representation, analysis, and code-generation techniques for Web services.