Feature #861
Is constrain-other-role the way to go?
| Status: | Closed | Start: | 2009-06-29 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | - | |||
| Target version: | - |
Description
Consider the case where we have cities contained in provinces
contained in countries:
place isa tmcl:topic-type;
is-abstract();
plays-role(containee, contained-in, 0, 1);
plays-role(container, contained-in, 0, *).
city ako place.
province ako place.
country ako place.
contained-in isa tmcl:association-type;
has-role(containee, 1, 1);
has-role(container, 1, 1);
constrain-other-role(containee, city, container, province);
constrain-other-role(containee, province, container, country).
As given, this would allow the following:
contained-in(containee: some-country, container: some-city)
contained-in(containee: some-country, container: some-province)
This can be solved by specifying plays-role for the subtypes, but if
so we can recreate the problem by adding another level (continent). Of
course, it can still be solved by adding the necessary
constrain-other-role statements for the container roles.
However, another alternative would be to make this symmetrical (ie: in
a sense it constrains both role types at the same time) by turning it
into a declaration. The idea is: if the association type has at least
one role-combination-constraint then only the combinations listed are
allowed.
With this approach the association type could be rewritten as:
contained-in isa tmcl:association-type;
has-role(containee, 1, 1);
has-role(container, 1, 1);
role-combination(containee, city, container, province);
role-combination(containee, province, container, country).
This would now suffice to specify the association type.
Note that the issue we have with the regular-expression-constraint,
reifier-constraint etc would with this solution not force us to create
common supertypes but could instead be solved simply by enumerating
the cases.
History
Updated by Graham Moore about 1 year ago
Discussed and decided that role-combination is the way to go.
Updated by Lars Marius Garshol about 1 year ago
- Status changed from New to Assigned
- Assignee set to Lars Marius Garshol
Updated by Lars Marius Garshol about 1 year ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
Now defined in the spec. Other-role-constraint removed.
Topic Maps Lab