Re: OK to use decimal for 0.3 in turtle?

Dan Connolly wrote:
> Dave,
> At XML 2005, we discussed this change:
> RESOLVED: change dataytpe for SPARQL floating point numerics to
> xsd:decimal contingent on Beckett's agreement to a similar
> change in Turtle.
>  --
> You seemed pretty much OK with the change, but I heard "I just
> need to check one more thing" disclaimers on your answers.
> Are you OK with the change?

I had a few concerns with sparql/turtle syntax alignment.  As I was 
composing this I found some more :)

1) I want to keep Turtle aligned with Notation 3 as implemented in cwm 
as far as is possible.

So I made a test file turtle1.ttl with some numeric examples:
@prefix : <> .
:a :b 1.0 .
:c :d 1 .
:e :f 1.0e0 .

and ran cwm on it fresh from a CVS checkout:

$ cwm -n3 -ntriples turtle1.ttl

     <>     <> 
"1.0"^^<> .

     <>     <> 
"1"^^<> .

     <>     <> 
"1.0"^^<> .

(*aside - note that the original lexical forms are not preserved; see 
the last case)

so my OK is conditional on N3 also making this change to xsd:double.

My test version of raptor (1.4.8 to be) gives the same answers as cwm:
$ rapper -q -i turtle -o ntriples turtle1.ttl
<> <> 
"1.0"^^<> .
<> <> 
"1"^^<> .
<> <> 
"1.0"^^<> .

2) Is there going to remain a shorthand syntax for xsd:double 
[xsd:float] also?

In C there is 1.0f (float) as well as variants.  Other languages have 
similar abbreviated forms.

Writing "1.0"^^xsd:double each time will be tedious (plus you have to 
define the xsd: namespace as there are no default pre-defined namespaces 
in sparql or turtle).

So what does XQuery do?  Finding
it has forms for integer, decimal and double (with an 'e' or 'E').

Looks like they don't care about float.

Maybe sparql, turtle/n3 should follow that.  It seems odd to not have 
short forms for constants for numeric datatypes that sparql supports and 
that n3/cwm uses given that they can be made relatively unambiguous. 
(What datatypes does cwm do artithmetic in?)

3) Iplementing arbitrary length decimal numbers

I was worried about this, mostly in C as that's what I use.

I did some research and I was happy that not only is there a GNU mp 
library (GPLed) and other implementations but there is ongoing work to 
add it to the C language, and there is a branch of code being added to 
GCC to support it, based on reference open source code.  These are the 
pointers I found:

(note that gcc recently moved to subversion so some of the gcc pointers 
in the ibm site are out of date)

So on the this final point I'm ok for myself.  There might be other 
languages that don't have such libraries, although conversely there are 
some with it builtin: python 2.4, java recent, ruby? at a quick search.

4) Negative numbers in Turtle/sparql/n3.

This was mentioned by AndyS (I think) as omitted from turtle and/or 
sparql probably by accident.

I'd like alignment on this too.  Here's a test file turtle2.ttl:
@prefix : <> .
:a :b -1.0 .
:c :d -1 .
:e :f -1.0e0 .

which cwm passes fine (returning the double types) but looks like it is 
not syntax in the grammar/my code for Turtle.  So I need to fix this.



Received on Tuesday, 22 November 2005 05:50:45 UTC