Re: an idea -- using different literal classes for each datatype

Sandro Hawke wrote:
> 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,

This seems to mean to you have to extend the RIF abstract (and thus 
concrete) syntax to add in a new datatype. Whereas in RDF and OWL no 
language change was needed to support a greater range of XSD types than 
the minimum. This strikes me as a desirable and successful feature which 
it would preferable if RIF could emulate.

> 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.  

The argument is a typed literal which comprises a lexical form (the 
string) and a datatype URI, which together denote a value determined by 
the lex->value mapping associated with the datatype.

I assume that predicates normally operate on the values and thus 
"p('1'^^xsd:long)" and "p('0x01'^^xsd:integer)" denote the same value.

However, we did propose builtins (based on the SPARQL) set which would 
allow you to write rules which can explicitly access the lexical form 
(str) and datatypes URI (datatype). I guess these builtins might need 
special treatment.

Dave
-- 
Hewlett-Packard Limited
Registered Office: Cain Road, Bracknell, Berks RG12 1HN
Registered No: 690597 England

Received on Tuesday, 28 August 2007 14:54:43 UTC