I'm saving a TTL file using RDFWriter.
How can I explicitly save literals with their data type?
For example, I want "5.36289"^^xsd:float but I get 5.36289E0 instead.
I had the same problem with strings, but I found the BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL property that solved. I cannot find any similar configuration for other data types.
I am creating the literals using the method Values.literal.
This is the source code:
FileOutputStream out = new FileOutputStream(ttlOutputFile);
RDFWriter writer = Rio.createWriter(RDFFormat.TURTLE, out);
final WriterConfig config = writer.getWriterConfig();
config.set(BasicWriterSettings.XSD_STRING_TO_PLAIN_LITERAL, false);
writer.startRDF();
for (Statement st : model) {
writer.handleStatement(st);
}
writer.endRDF();