On Feb 7, 1:43 am, Hrvoje Simic <
hrvoje.si...@gmail.com> wrote:
> I just checked in the revision 218:
http://code.google.com/p/scardf/source/detail?r=218
>
> It's mixed in with a bigger design change concerning predicate trees.
> Sorry for that.
>
> Now the TypeNodeConverter class takes the function UriRef => Boolean
> which determines which XML Schema types can be converted. The idea is
> that, although most RDF has integers as xsd:integer, you would want to
> work with Ints in Scala. Now you can use either asInt or asBigInt,
> depending on your needs.
>
> If you have the time, please check if this implementation matches your
> expectations.
>
> Other converters could be extended to allow more XML types. E.g.
> asBigDecimal could take xsd:integers.
>
> Hrvoje
>
>
>
>
>
>
>
> On Thu, Feb 3, 2011 at 19:38, Hrvoje Simic <
hrvoje.si...@gmail.com> wrote:
> > Thanks for this.
>
> > I was thinking of naming the TypeNodeConverter[BigInt] converter "asBigInt".
>
> > Also, I'm thinking that TypeNodeConveters should be allowed to convert
> > literals of multiple types, since integers in RDF are usually
> > xsd:integer but Ints in Scala. So asInt could make Ints from both
> > xsd:int and xsd:integer typed literals - considerations of integer
> > size would be left to the developer.
>
> > Hrvoje
>
> > On Thu, Feb 3, 2011 at 19:21, Leif Warner <
abimel...@gmail.com> wrote:
> >> From what I've read it seems xs:integer is supposed to be an
> >> arbitrary-precision integer type. It's a subtype of decimal.
> >> Currently it gets mapped to Int, while xs:int doesn't look to be handled.
> >> Here's a patch to sort that out. Not sure what naming you'd like to use,
> >> e.g. for the /asInt or /asInteger (/asBigInt?) part.
> >> I'm used to that convention from Haskell, where "Int" is the int32 type, and
> >> "Integer" is the arbitrary precision one, but on the Java platform that
> >> might be confusing, as historically "Int" is the primitive int32, and
> >> "Integer" is just an object wrapper for that.
> >> FYI, I came across this when turning a Scardf augmentation rule into a Jena
> >> rule. The Util.makeIntNode [1] method puts an xs:int in there, and /asInt
> >> would complain and refuse to work on those values because it was expecting
> >> something marked xs:integer.
> >> xs:integer is what I get when I put a bare numeric literal into a turtle
> >> file and run rapper (Redland utils) on it, though. If there's a bunch on
> >> needless BigInts in there, they could be checked (e.g. BigInt(foo).abs <
> >> MAX_INT) and converted to Int, at the expense of some static typing,
> >> however.