Coal mine accidents, for example, water leakage and collapse, can damage the circuit system, and they in turn can affect the stable operation of the coal mine. Therefore, it is necessary to identify the causes of coal mine accidents and reduce the number of accidents in coal mines. Government and enterprises have already accumulated numerous coal mine accident cases. To summarize the characteristics and rules of accidents, survey the deep cause of the accident, avoid the recurrence of similar accidents, and early pre‐control of risk source, there is a need to analyze the correlation in the accident characteristics. Then, with the help of ontology knowledge service model, we address this issue in this article. For guaranteeing the inference efficiency of ontology knowledge, we propose a semiautomatic construction method for coal mine accident cases to construct ontology. Here, the reliability of ontology construction and the professionalism of domain knowledge provide a feasible approach to ontology learning using structured and semi‐structured data sources. Furthermore, the weighted Word2vec and spectral clustering method are combined, an intelligent recommendation algorithm with accident ontology is accordingly presented, while presenting a local optimal distance calculation similarity strategy. This method can serve as an assistant to help users mine similar coal mine accident cases. Finally, the experimental results show that after comparing with some other popular methods, the proposed approach can achieve a satisfactory performance on the coal mine dataset with an accuracy of 99.47%, the precision of 98.92%, and the F1‐score of 99.35.