Subclassing literals in RDFa API

I'm a big fan of adding optional bits to specs. I'm an implementer, so I
like optional bits because optional bits tend to be the bits where
implementers can have some fun. So what I'm proposing is an optional
bit.

Where the RDFa API would normally return an object of type RDFLiteral,
it should be allowed to return an object of some other type that
implements the RDFLiteral interface.

If we imagine an RDFa API implementation in a language that supports
multiple inheritance, a literal with datatype xsd:dateTime might be
returned as an object that's a subclass of RDFLiteral, and also a
subclass of the programming language's native datetime object.

Or in a language which doesn't do multiple inheritance, it the same
literal might be represented as a subclass of RDFLiteral with an extra
attribute called "datetime" that contains a copy of the datetime in the
programming language's native datetime object.

I can imagine implementations wanting to provide such subclasses for
types xsd:dateTime (and other XSD date- and time-related datatypes),
rdf:XMLLiteral and xsd:anyURI, though I'm not suggesting this option be
restricted only to those - if an implementation wants to be able to do
something special with xsd:unsignedByte, then why not let it?

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Thursday, 1 April 2010 18:01:30 UTC