port in a chunk of just-barely modified parser code from the Jena Framework