1

Adoctor可以属于subjectCat(尝试访问的用户)或resourceCat(对象尝试访问的医学检查的转诊医生)。

在我看来,为了支持这两种情况,我需要分别doctor为每个类别定义:

namespace subject {
     namespace doctor {
          attribute id {
                    category = subjectCat
                    id = "id"
                    type = string
          }
          attribute lastname {
                    category = subjectCat
                    id = "lastname"
                    type = string
          }
          //and 20 more attributes...
      }
}


namespace resource {
     namespace doctor {
          attribute id {
                    category = resourceCat //this line is the only difference
                    id = "id"
                    type = string
          }
          attribute lastname {
                    category = resourceCat //this line is the only difference
                    id = "lastname"
                    type = string
          }
          //and 20 more attributes...
      }
}

这很麻烦,而且有很多冗余。我能做些什么来避免这种情况吗?

4

1 回答 1

1

你说的对。您将重新定义属性。在某种程度上,您使用信息模型中的相同对象(例如医生),但在一种情况下,该对象(医生)充当主题。在另一个方面,它充当您正在保护的对象,例如

  • 医生可以查看分配给他们的患者的病历。
  • 人力资源人员可以查看医生的工资。

是的,这意味着您必须在多个类别中定义属性本身。只要名称空间和名称的组合保持唯一,您仍然可以利用名称空间结构。

你可以做acme.user.staff.doctor和属性name。然后你可以做acme.object.doctor和属性name

请注意,Eclipse 也会让您执行自动完成功能:

在 Eclipse 中的 ALFA 中自动完成属性名称

于 2018-05-24T16:48:12.523 回答