As a significant percentage of disasters and fatal accidents still occur in the construction sector, it is legally obligatory to conduct workplace risk assessments to avoid accidents and enhance safety. Identifying harmful and hazardous elements is crucial to discern the distinctive characteristics of potential accidents. However, conventional risk-assessment approaches, which rely on the skills and experience of safety managers, may overlook important factors, leading to inconsistencies in the procedures employed across different sites. Such unstructured safety knowledge reduces accessibility and utility, increases reliance on individual skills, and renders information management inefficient. Recently, the focus has shifted from efficient data storage to obtaining valuable knowledge tailored to specific use-cases. Knowledge-graph-based systems integrate and manage the relationships between knowledge entities, thereby enhancing the development of knowledge bases. Research on automatically extracting and managing predefined knowledge from various forms of data through natural language processing (NLP) is ongoing. This study proposes a novel method that uses NLP and graph models to automatically extract predefined knowledge from unstructured construction data and build an entity-relationship-based risk-assessment knowledge base. We developed an entity-name recognition and keyword-extraction engine that defines the core knowledge related to construction safety and risk assessments. This engine can automatically extract predefined knowledge from unstructured data by learning from NLP data. The extracted risk-assessment knowledsge was used to create a knowledge base, and its efficiency and effectiveness were validated through comparisons with existing methods. The results of this study are significant because they lay the foundation for an automatic knowledge-management system for construction safety and risk assessment, offering both practical and academic contributions to the field of construction safety.