The ability of a knowledge graph (KG) to evaluate vast amounts of celestial data and knowledge, as well as identify possible patterns and relationships between celestial bodies, is crucial for astronomy research. However, traditional construction methods are labor-intensive, lacking high-quality and efficient approaches, resulting in KGs with limited coverage and structural clarity. This paper proposes an automatic astronomical KG construction method from literature (AstroKGC). Six Large Language Models were used in ablation experiments to evaluate the effectiveness of different components of the proposed method. The results show that the AstroKGC method could enhance the performance for both online models like Claude 3.5 Sonnet and GPT-4o, and locally deployed models like Llama3.1 and DeepSeek-R1. Considering the convenience of locally deployed models, the optimal DeepSeek-R1:671B was selected as the backbone for the KG construction. Finally, we constructed a large-scale spiral galaxy knowledge base in astronomy. This KG comprises about 300,000 semantically rich triples which are extracted from 18,341 spiral galaxy related literature abstracts. The source code and knowledge base data sets have been made publicly available in the China-VO paper data repository.

