<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Lars Heuer wrote:
<blockquote cite="mid:1635389316.20090330185402@semagia.com" type="cite">
  <pre wrap="">Hi Lars,

  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">Yes, I think we should allow something like

    def mapping($t, $q)
        $t
        mapping: $q^^sql:query.
    end
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->

  </pre>
  <blockquote type="cite">
    <pre wrap="">What happens if I then use the template as follows?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <pre wrap="">   mapping(foo, "select ..."^^xsd:string).
   mapping(foo, "select ..."^^bar:sql-query).
   mapping(foo, 1).
    </pre>
  </blockquote>
  <pre wrap=""><!---->
:)

Well, after I've written the enthusiastic "Yes, we should", I wondered
if this is a good idea. The problem is, that the TMDM provides only
limited support for literal values != xsd:anyURI and xsd:string. If
someone uses

    mapping(foo, "1.0000"^^xsd:decimal)

or

    mapping(foo, 1.0000)

the result should be (according to TMDM which forbids normalization of
literals):

   foo
   mapping: "1.0000"^^sql:query.


but a more sophisticated Topic Maps engine may produce:

   foo
   mapping: "1.0"^^sql:query.

since the value of "1.0000" can be translated to "1.0" (canonical form
of the xsd:decimal value).

So, we need a policy how to translate a value from one datatype to
another. The canonical representation would be an option but since it
is not mentioned in the TMDM, I wonder if this policy is doable.

Requiring that the string which was provided by the user is kept,
would be wrong imo.
  </pre>
</blockquote>
Well, why?<br>
<br>
We can make it very simple:<br>
<blockquote>An attempt to set the datatype only succeeds either if the
old datatype is xsd:string or if the old datatype equals the new
datatype, otherwise such an attempt is an error.</blockquote>
The purpose of overriding datatypes is to make it possible to write
typed strings as template-arguments without providing the type
information over and over again.<br>
The purpose of overriding datatypes is not to create all kinds of fancy
conversions between the values, neither syntactic conversions nor
semantic conversions nor anything inbetween (e.g. conversion to
canonical values).<br>
<br>
What do you think about limiting the scope of overriding datatypes for
cases where string literals were used (as outlined above)?<br>
<blockquote cite="mid:1635389316.20090330185402@semagia.com" type="cite">
  <pre wrap="">
I tend to join Graham's fan club and leave CTM as it is (regarding
this issue) just to avoid the ugliness of translating literals from
one datatype to another.

Best regards,
Lars
  </pre>
</blockquote>
<br>
ciao,<br>
Xuân.<br>
<br>
</body>
</html>