I’m trying to map a relational database to an ontology.
I read many approaches like 1 2 and they all agreed to model bridge tables (join table between two tables connected with each other with many-to-many relationship) as follows:
- If the bridge table contains exactly two foreign keys without presence of independent attributes, it can be mapped into two object properties, the latter is an inverse of the former.
- If the bridge table contains exactly two foreign keys with presence of independent attributes, it should be mapped into separate OWL classes.
With that in mind, if we have two tables: students and courses and the join table contains only three columns:
id, student_id, course_id
we model the ontology with two classes: student and course, and two relationships "object properties" :
student ---study---> course
course ---studied_by---> student
but if the join table contains one independent attribute or more, let's say it contains:
id, student_id, course_id, grade
then a new class should be created in the ontology. we model the ontology with three classes: student, course, student_course and two object properties :
student ---student_has---> student_course
course ---course_has---> student_course
is this the best solution?