Bug #847
Variant constraint
| Status: | Closed | Start date: | 2009-06-29 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | - |
Description
Naito-san wrote:
The variants can't constrain by the types because they can't have the types.
But the following constraints of the variants are required in some case:
- Cardinality Constraint
- Scope Constraint
- Reifier Constraint
- Unique Value Constraint
- Regular expression Constraint
I think the way to constrain cardinality of the variants can be added into
the Topic Name Constraint and it should be.
I don't know the way to constrain others. Are there any way to constrain
them? Do we need to add the type of variant into the TMDM?
History
Updated by Lars Marius Garshol over 2 years ago
- Assignee set to Lars Marius Garshol
Updated by Graham Moore over 2 years ago
Will try and do a proposal that binds the variant constraint to name types.
Updated by Lars Marius Garshol over 2 years ago
- Status changed from New to Assigned
Updated by Lars Marius Garshol over 2 years ago
Naito-san posted some use cases: http://www.infoloom.com/pipermail/topicmapmail/2009q2/007497.html
Updated by Lars Marius Garshol over 2 years ago
Xûan has another, which basically amounts to sort names: http://www.infoloom.com/pipermail/topicmapmail/2009q2/007483.html
Updated by Lars Marius Garshol over 2 years ago
def has-variant($nt, $scopetype, $min, $max)
?c isa tmcl:variant-constraint;
tmcl:card-min: $min;
tmcl:card-max: $max.
tmcl:constrained-statement(tmcl:constrains : ?c, tmcl:constrained : $nt)
tmcl:constrained-scope(tmcl:constrains : ?c, tmcl:constrained : $scopetype)
end
realName isa tmcl:name-type;
- "Real name";
has-variant(hiragana, 1, 1);
has-variant(romaji, 1, 1).
We might add a variant-scope-constraint, variant-reifier-constraint, variant-unique-value-constraint, and variant-regular-expression-constraint where we use the tmcl:constrained-scope to say which variants are constrained (it's those which have topics of this type in their scope).
Thus one could probably say:
reading isa transliteration-type.
hiragana isa script.
romaji isa script.
realName isa tmcl:name-type;
- "Real name";
has-variant(script, 0, *).
script
has-variant-scope(transliteration-type, 1, 1).
Unfortunately, this suffers from several problems:
- has-variant-scope can only be attached to the type of scoping topic used in has-variant, but it looks out of place there, as scripts may well be normal topics in their own right.
- realName may well have variants scoped with script and transliteration-type, but it's not a given that all variants scoped with script are also scoped with transliteration-type.
- it would be better to be able to say directly that variants of realName must be scoped with one script and one transliteration-type.
- are the scoping rules here really expressible via topic type? or should we say that realName must be scoped with one script and the topic "reading"?
It's not easy to see how to approach this, given that we have so few
use cases and so little real experience with this.
Note that many of these problems recur for issue 868:
http://projects.topicmapslab.de/issues/868
Updated by Lars Marius Garshol over 2 years ago
- Status changed from Assigned to Rejected
The Seattle meeting considered this, and concluded: "Don’t do these. Tell people to create TMQL to constrain variants." So we are not adding these constraints.
Updated by Lars Marius Garshol about 2 years ago
- Status changed from Rejected to Assigned
Reopening this based on recent discussion.
We now have a concrete proposal:
def has-variant($tt, $nt, $t, $min, $max) ?c isa tmcl:variant-constraint; tmcl:card-min: $min; tmcl:card-max: $max. tmcl:constrained-topic-type(tmcl:constrains : ?c, tmcl:constrained : $tt) tmcl:constrained-statement(tmcl:constrains : ?c, tmcl:constrained : $nt) tmcl:required-scope(tmcl:constrains : ?c, tmcl:constrained : $t) end
Updated by Lars Marius Garshol about 2 years ago
The Leipzig meeting noted:
This proposal is underpowered. It cannot express different cardinalities for the different topics appearing on different variants. Suggested that this compromise of ‘one scope’ supported would be acceptable in order to advance the completion of standard.
Updated by Lars Marius Garshol about 2 years ago
Question from the Leipzig meeting:
Do we need $tt for variant constraints, wouldn’t they be consistent across all uses of the name type, regardless of topic type?
Updated by Lars Marius Garshol about 2 years ago
Lars Marius Garshol schrieb:
We now have a concrete proposal:
[...]
We'll put this proposal into the next draft, even though we realize that it is underpowered. The problem is that doing something more complete would be highly complex and bloat the standard too much compared to its utility.
Regarding the question from the Leipzig meeting about $tt: the $tt is needed because very often $nt will be tmdm:topic-name, and so there will be different rules for different topic types. If one wants a global rule $tt can be set to tmdm:subject.
Updated by Lars Marius Garshol almost 2 years ago
- Status changed from Assigned to Closed
It's now in the specification.
Topic Maps Lab