Modeling an ontological graph in SQL: the problem of two fathers

I simulate an ontology in SQL, using a tree to indicate relationships between concepts. My problem is how to find out concepts in a graph / tree without replicating concepts.

Eg. I have the concept of courses: "karate", "sailing" (lessons that can be taken from instructors) and places: "gym", "boat club", where these courses can be taken. On the chart it will be:

gym        boat club
   has     has
     courses
   of        of
karate    sailing

How can I simulate this schedule to avoid a karate boat club and without duplicating the concept of courses?

Thank!

+3
source share
2 answers

. () - , , , , - () . :

Links
  from (concept foreign key)
  to (concept foreign key)
  link_type (has/of/etc)

SQL, .

+2

, "" " ", . , , .

0

Source: https://habr.com/ru/post/1793955/


All Articles