Bug #850
Define datatype matching
| Status: | Closed | Start date: | 2009-06-29 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | - |
Description
At the moment datatype matching is not defined in the draft, and this issue is unfortunately more complicated than it may seem at first glance.
Consider the following:
c isa tmcl:foo-constraint;
card-min: 1;
card-max: *.
The result is a card-min occurrence with datatype xsd:integer and a card-max occurrence with datatype ctm:integer. Now, if we say the datatype of such occurrences is ctm:integer, is the first valid?
That is, do we need to take subtyping of datatypes into consideration? If so, how do we know what the subtypes of any given datatype are?
History
Updated by Graham Moore over 2 years ago
LMG to write a proposal for this.
Updated by Lars Marius Garshol over 2 years ago
- Status changed from New to Assigned
- Assignee set to Lars Marius Garshol
Updated by Lars Marius Garshol over 2 years ago
I wrote a loong essay on this: http://www.garshol.priv.no/blog/203.html
Make sure to read Michael's comment underneath.
Updated by Lars Marius Garshol over 2 years ago
The Seattle meeting discussed this and came to the following conclusion:
Given a declared datatype for an occurrence type (t1), and an actual occurrence (with value v and datatype t2), under what circumstances are the occurrence valid? The occurrence is valid if - v is XML Schema datatype valid according to t1, - v is XML Schema datatype valid according to t2, - the value spaces of t1 and t2 overlap This means that if tmcl:card-min is declared as ctm:integer - (1, xsd:int) will be accepted - (1, ctm:integer) will be accepted - (1, xsd:byte) will be accepted - (1.0, xsd:decimal) will not be accepted For this to work, TMCL implementations must - know the lexical space of each supported datatype - know the value space relationships between supported datatypes" However, we leave the notion of overlap in favour of subtyping, which apparently is defined in XSD datatypes after all. Also, we only accept the declared type or its subtypes. Instances of supertypes are explicitly not accepted.
Updated by Lars Marius Garshol over 2 years ago
Note to self: tmcl:card-min and card-max are declared as ctm:integer, but if you write
foo tmcl:card-min: 5.
the datatype will actually be xsd:int, not ctm:integer. We need to make sure we don't screw up validation of these values.
Updated by Lars Marius Garshol over 2 years ago
- Status changed from Assigned to Closed
Added this to the spec in what I think is the correct XML Schemaese.
Topic Maps Lab