This documentation of TurtleParser might be useful
Add the IRI.prototype.toURIString function and lots of cleanup