在建立ER图的时候 ,发现出现关系出现了环。 
下面是相关的实体 
邮票  信件  用户 用户拥有邮票 , 1:n 
用户可以发出信件 , 1:n 
一张邮票贴在一个信件上, 1:1 
结果这样关系出现了环,这个问题应该如何考虑?

解决方案 »

  1.   

    现在我描述的情况 是不是还不是环?
    环应该是entity A 依赖entity B , entity B 依赖 entity C, entity C 依赖 entity A
    是这样吧
      

  2.   

    PowerDesigner 系统分析与建模
    page68 , 作者 赵韶平 罗海燕 李霁红 李志等编著,
    清华大学出版社 
    1.检查包(Package)
    (1)包中不能存在循环依赖联系
      

  3.   

    应该不是范式, PowerDesigner 里面 CDM的包, 应该还是 Entity Relation相关部分。不过我理解上满糊涂的,担心的就是出现 entity A 依赖entity B , entity B 依赖 entity C, entity C 依赖 entity A 这样的情况。
      

  4.   


    /*==============================================================*/
    /* Table: ic_mail                                               */
    /*==============================================================*/
    create table ic_mail
    (
       MAIL_OID             bigint not null,
       USER_OID             bigint comment '识别码',
       STAMP_OID            bigint not null,
       MAIL_ID              varchar(50),
       MAIL_CONTENT         varchar(2000),
       MAIL_TITLE           varchar(100),
       CREATE_DATETIME      date,
       STATUS               tinyint,
       FROM_USER            varchar(12),
       TO_USER              varchar(12),
       primary key (MAIL_OID)
    );/*==============================================================*/
    /* Table: ic_stamp                                              */
    /*==============================================================*/
    create table ic_stamp
    (
       STAMP_OID            bigint not null,
       MAIL_OID             bigint,
       USER_OID             bigint comment '识别码',
       STAMP_ID             varchar(50),
       TYPE                 varchar(10),
       CREATE_DATETIME      date,
       primary key (STAMP_OID)
    );
    /*==============================================================*/
    /* Table: ic_user                                               */
    /*==============================================================*/
    create table ic_user
    (
       USER_OID             bigint not null comment '识别码',
       USER_ID              varchar(12),
       REG_MAIL             varchar(100) comment '注册邮箱',
       LOGIN_PSWD           varchar(50) comment '登录密码',
       NICK_NAME            varchar(100) comment '昵称',
       GENDER               smallint comment '性别',
       FREE_STAMP_NUM       tinyint,
       BOUGHT_STAMP_NUM     tinyint,
       primary key (USER_OID),
       key AK_Identifier_2 (USER_OID)
    );alter table ic_mail add constraint FK_mail_stamp2 foreign key (STAMP_OID)
          references ic_stamp (STAMP_OID) on delete restrict on update restrict;alter table ic_mail add constraint FK_mail_user foreign key (USER_OID)
          references ic_user (USER_OID) on delete restrict on update restrict;alter table ic_stamp add constraint FK_mail_stamp foreign key (MAIL_OID)
          references ic_mail (MAIL_OID) on delete restrict on update restrict;alter table ic_stamp add constraint FK_stamp_user foreign key (USER_OID)
          references ic_user (USER_OID) on delete restrict on update restrict;