// (e.g. a value of "fish" for an xsd:integer literal,
// or a value of 1995-01-01T00:00:00+02:00 for an xsd:gYear literal).
// The default behavior is to throw an exception when bad literals are encountered,
// resulting in failure.
private static void ignoreDatatypesInAllParsers() {
RDFParserRegistry r = RDFParserRegistry.getInstance();
Collection<RDFParserFactory> oldFactories = new LinkedList<RDFParserFactory>();
Collection<RDFParserFactory> newFactories = new LinkedList<RDFParserFactory>();
for (final RDFFormat f : r.getKeys()) {
final RDFParserFactory pf = r.get(f);
pf.getParser().setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);
RDFParserFactory pfn = new RDFParserFactory() {
public RDFFormat getRDFFormat() {
return f;
}
public RDFParser getParser() {
RDFParser p = pf.getParser();
p.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE);
return p;
}
};
oldFactories.add(pf);
newFactories.add(pfn);
}
for (RDFParserFactory pf : oldFactories) {
r.remove(pf);
}
for (RDFParserFactory pfn : newFactories) {
r.add(pfn);
}
}