With the rapid development of the Semantic Web, building the ontology with the existing data resources has gained a great degree of attention. Therefore, the RDF (Resource Description Framework) plays a important role in the Semantic Web. Since large amounts of data is stored in relational databases, how to convert the data in relational databases to RDF becomes a critical problem. This paper proposes a method with which relational database can be automatically mapped to RDF and gives a detailed mapping rules and the conversion process. An example is given to verify the feasibility of the measure.