It is my understanding that a binary can only be objectified if it has a uniqueness constraint that spans both roles or if each role has a uniqueness constraint. I don't understand this limitation. Suppose I am modeling the process of assigning work to someone else. Here are the relevant facts:
- TaskRequest(id) is sent by [1] Person
- TaskRequest(id) is request to [1] Person
- TaskRequest(id) includes [1] WorkDescription
- TaskRequest(id) received response on [0 or 1] DateTime
Now with regard to
last predicate, suppose a TaskRequest can only receive a single response. So there is a unique constraint on the TaskRequest role but NO unique constraint on the DateTime role. It seems natural to objectify that predicate as a "Response". And then I'll have some other predicates like:
- Response included [1] Note
- Response was of [1] ResponseType(code) 'yes' or 'no'.
Why isn't it legal to objectify the binary this way?
There are other ways to model this that seems less natural and more cumbersome. For example, I can create a subtype of TaskRequest called TaskRequestWithResponse, where TaskRequestWithResponse is a TaskRequest that received response on some DateTime. And then I can attach the response roles to that sub-type. Another alternative is to attach the response predicates to the TaskRequest directly, like TaskRequest received response of ResponseType, but then I need to add a lot of complex subset constraints to indicate that all the response facts only apply if the TaskRequest received response on some DateTime.
I'd also be happy to add a new fact TaskRequest(id) received [0 or 1] Response, in which each role has a uniqueness constraint. And then I can attach the response roles to the Response object. But I'm not sure how to specify the reference mode of the Response. If anything, the reference mode on the Response should be the same as the reference mode on the Request. In other words, a TaskRequest with identity 3 would only have a Response with identity 3; the Response would not have an identity outside of the TaskRequest it is associated with. Is this approach legal ORM?