Functional modeling in safety by means of foundational ontologies