用 SQL 建模本体图:两个父亲的问题

发布于 2024-10-18 09:44:32 字数 515 浏览 0 评论 0原文

我正在 SQL 中使用树来建模本体来指示概念之间的关系。 我的问题是如何在不复制概念的情况下消除图形/树中概念的歧义。

例如。我有课程的概念:“空手道”、“帆船”(可以从教练那里学习的课程)和可以学习这些课程的地方:“健身房”、“划船俱乐部”。在图中它将是:

健身房       游船俱乐部
  有    有
     课程
       
空手道    帆船

我如何对该图进行建模,以避免船舶俱乐部开设空手道课程,并且不重复课程的概念?

谢谢!

I'm modelling an ontology in SQL using a tree to indicate relations between concepts.
My problem is how to disambiguate concepts in a graph/tree without replicating concepts.

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


gym        boat club

   has     has
     courses
   of        of
karate    sailing

How can I model this graph to avoid boat club having karate courses and without duplicating the concept of courses?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

別甾虛僞 2024-10-25 09:44:32

我会翻转整个数据架构并将其视为一个图表。为所有概念(节点)(健身房、划船俱乐部、课程、空手道、帆船)准备一张表格,并用另一张表格来创建它们之间的链接(顶点)。该表看起来像这样:

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

可能需要更多的 SQL 才能在内存中构建所有信息,但此模式将简单地处理这些关系。

I would turn the whole data architecture around and think about this as a graph. Have a table for all the concepts (nodes) - gym, boat club, courses, karate, sailing - and another table to create the links (vertices) between them. That table looks something like:

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

It may take a lot more SQL to build up all your information in memory, but this schema will handle these relationships simply.

∞琼窗梦回ˉ 2024-10-25 09:44:32

包含数据 Karate 和 Sailing 的表将包含其他两个表的主键作为外键。这将允许您拥有任意数量的每种数据类型,同时仍然能够遍历表以获取信息。

The table that contains the data Karate and Sailing would contain the primary keys for the other two tables as foreign keys. This would allow for you to have as many of each data type as you like while still being able to traverse the tables to get your information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文