Semantic-Driven Modeling And Reasoning For Enhanced Safety Of Cyber-Physical Systems