gpt4 book ai didi

entity-relationship - 文本中的实体关系符号

转载 作者:行者123 更新时间:2023-12-04 08:08:44 26 4
gpt4 key购买 nike

实体关系是否有标准(非图形)表示法?

现在我正在使用我自己的 janky 符号:

  • 用户 >> 照片, (1-many)
  • 用户 > 个人资料,(1-1 hasOne)
  • 个人资料 < 用户 ,(1-1 属于)
  • 照片 << 用户,(多 1 属于)
  • 照片 <> 标签,(多对多)
  • 最佳答案

    差不多 10 年后,我也很难找到明文标准。这是我到目前为止所发现的(尽管有公平的警告,它主要是碰巧在文本中运行良好的图形标准)。

    首先,描述对象之间关系的基数的常用术语是“多重性”。

    This association relationship indicates that (at least) one of the two related classes make reference to the other. This relationship is usually described as "A has a B" (a mother cat has kittens, kittens have a mother cat).



    尽管相当多的资料来源也使用“基数”一词。
    关于 Multiplicity vs Cardinality 的这个 SO question 上的差异有一些很好的答案。我发现这个非常简洁:

    ...a multiplicity is made up of a lower and an upper cardinality. A cardinality is how many elements are in a set. Thus, a multiplicity tells you the minimum and maximum allowed members of the set.



    UML 的多重表示法

    UML 的 multiplicity notation 在文本中运行良好。
    +--------------+--------+-----------------------------------------+
    | Multiplicity | Option | Cardinality |
    +--------------+--------+-----------------------------------------+
    | 0..0 | 0 | Collection must be empty |
    | 0..1 | | No instances or one instance |
    | 1..1 | 1 | Exactly one instance |
    | 0..* | * | Zero or more instances |
    | 1..* | | At least one instance |
    | 5..5 | 5 | Exactly 5 instances |
    | m..n | | At least m but no more than n instances |
    +--------------+--------+-----------------------------------------+

    这似乎有一些变化:
  • 微软的 Relational Notation
    +---------------------------------+---------------------+
    | Multiplicity | Cardinality |
    +---------------------------------+---------------------+
    | * | One to zero or more |
    | 1..* | One to one or more |
    | 0..1 | One to zero or one |
    | 1 | Exactly one |
    | Two numbers separated by a dash | a range |
    +---------------------------------+---------------------+
  • IBM's
    +------+--------------------+-------------------------------+
    | Rose | Software Architect | Description |
    +------+--------------------+-------------------------------+
    | n | * | Unlimited number of instances |
    | 1 | 1 | Exactly 1 instance |
    | 0..n | * | 0 or more instances |
    | 1..n | 1,,* | 1 or more instances |
    | 0..1 | 0..1 | 0 or 1 instances |
    +------+--------------------+-------------------------------+
  • Smartdraw 的 Martin Style

  • 陈风

    来自 what I've read Chen的风格是“原始格式”。我 commonly see this expressed in text 为:
    +----------+--------------+
    | Notation | Description |
    +----------+--------------+
    | 1:1 | One to One |
    | 1:N | One to Many |
    | N:1 | Many to One |
    | M:N | Many to Many |
    +----------+--------------+

    IDEF1X 等

    IDEF1x(NIST 标准):

    IDEF1X is a method for designing relational databases with a syntax designed to support the semantic constructs necessary in developing a conceptual schema.



    这似乎描述了维基百科 Min-Max / ISO notation 引用的 here's a German article (英文链接目前已断开,但 Entity–relationship model article ),其中还列出了一些其他样式的图形符号,其中一些是文本友好的。

    enter image description here

    德语 article on (min,max) notation 也有一个比较 UML, Chen, (min,max) 和 MC (Modified Chen) 的有用表格:
    +----------------------+-----------------+---------------------------------+-------------+-----------------+----------------------+
    | (min,max) [Entity 1] | [UML, Entity 1] | Chen-Notation | MC-Notation | [UML, Entity 2] | (min,max) [Entity 2] |
    +----------------------+-----------------+---------------------------------+-------------+-----------------+----------------------+
    | (0,1) | 0..1 | 1:1 | c:c | 0..1 | (0,1) |
    | (0,N) | 0..1 | 1:N | c:mc | 0..* | (0,1) |
    | (0,N) | 1..1 | 1:N + total participation | 1:mc | 0..* | (1,1) |
    | (0,N) | 0..* | M:N | mc:mc | 0..* | (0,N) |
    | (1,1) | 0..1 | total participation + 1:1 | c:1 | 1..1 | (0,1) |
    | (1,N) | 0..1 | total participation + 1:N | c:m | 1..* | (0,1) |
    | (1,1) | 1..1 | total part. + 1:1 + total part. | 1:1 | 1..1 | (1,1) |
    | (1,N) | 1..1 | total part. + 1:N + total part. | 1:m | 1..* | (1,1) |
    | (1,N) | 0..* | total participation + M:N | mc:m | 1..* | (0,N) |
    | (1,N) | 1..* | total part. + M:N + total part. | m:m | 1..* | (1,N) |
    +----------------------+-----------------+---------------------------------+-------------+-----------------+----------------------+

    关于entity-relationship - 文本中的实体关系符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1528132/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com