W3C home > Mailing lists > Public > public-rif-wg@w3.org > August 2007

an idea -- using different literal classes for each datatype

From: Sandro Hawke <sandro@w3.org>
Date: Mon, 27 Aug 2007 16:39:34 -0400
To: public-rif-wg@w3.org
Message-ID: <10115.1188247174@ubuhebe>


I just had another idea for how to solve the twin issues of 
     - xsi:type vs rdf:datatype
and  - literals in lists

The idea is to make the types an explicit part of the grammar of the
dialect.   So we get something like this:

================================================================

class Term

    subclass Var
        property name: xs:string

    subclass Constant

        subclass Literal

             subclass Literal_string
                 property stringValue: xs:string

             subclass Literal_string_with_language_tag
                 property stringValue: xs:string
                 property language: xs:string
             
             subclass Literal_int
                 property intValue: xs:int
                 
             subclass Literal_decimal
                 property decimalValue: xs:decimal

             subclass Literal_datetime
                 property datetimeValue: xs:datetime
     
================================================================

I like how this makes the ASN a more complete description of the
dialect.  It's very XML-happy, I think -- a schema processor will get
the right types for everything.

Not using rdf:datatype makes things a bit harder for RDF folks, but I'm
not sure the semantics of rdf:datatype were right anyway.  Honestly, I
have no idea if, in RIF, "p(1)" is supposed to be conveyed they same as
"p(0x01)" -- that is, is the argument supposed to be the integer one, or
is it supposed to be some string with an associated datatype.  There's a
kind of an abstractness-knob in the design of RIF about how much RIF
describes the pure-syntax (including things like whitespace and whether
decimal or hex was used).

Anyway, doing this approach solves the parsetype=Collection problem,
because it keeps the datatyping in the domain of RIF, and you end up
with things like this:

    <arg rdf:parseType="Collection">
        <Literal_int><intValue>1</intValue></Literal_int>
    </arg>

I think it's my current favorite approach.

      -- Sandro
Received on Monday, 27 August 2007 20:42:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 2 June 2009 18:33:40 GMT