ISSUE-50: TypedLiteralConverter modifier parameter [RDFa 1.1 API]

ISSUE-50: TypedLiteralConverter modifier parameter [RDFa 1.1 API]

http://www.w3.org/2010/02/rdfa/track/issues/50

Raised by: Nathan Rixham
On product: RDFa 1.1 API

Spec Issue:
"The RDFa Working Group is still discussing whether or not having a modifier is a good idea as 90% of use cases will never use it and the remaining use cases could provide the functionality with an external switch to the conversion function."

Proposal:
  remove "modifier" from DataContext.convertType and TypedLiteralConverter.convert
  change return of registerTypeConversion from void to TypedLiteralConverter.

IDL:

interface DataContext {
    void setMapping (in DOMString prefix, in DOMString iri);
    TypedLiteralConverter registerTypeConversion (in DOMString iri, in TypedLiteralConverter converter);

    IRI  resolveCurie (in DOMString curie);
    any  convertType (in DOMString value, in optional DOMString inputType);
}

[NoInterfaceObject Callback]
interface TypedLiteralConverter {
    any convert (in DOMString value, in optional IRI inputType);
}; 


TypedLiteralConverter usage:

function myStringIntConverter(value,inputType) {
  // implementation which returns a string representation
  // of an int rather than a native int
}
var context = document.data.context;
// get the native converter and register a custom one
var nativeConverter = context.registerTypeConversion('xsd:int', myStringIntConverter);
// work with data
context.registerTypeConversion(nativeConverter); //return to native mode

The above should handle any use case which the modifier parameter could handle, without needing an additional parameter.

Received on Wednesday, 27 October 2010 01:31:51 UTC