Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
Jena 5.1.0
-
None
-
None
Description
The following sample code reproduces the issue:
public static void main(String[] arguments) { try { FileUtils.deleteDirectory(new File("sample-data")); } catch (IOException e) { throw new RuntimeException(e); } Dataset dataset = TDB2Factory.connectDataset("sample-data"); Txn.executeWrite(dataset, () -> { // TDB: code wrongly prints out "2.0" Model model = dataset.getDefaultModel(); // in-memory: code correctly prints out "2" //Model model = ModelFactory.createDefaultModel(); model.add( ResourceFactory.createResource("http://www.test.com/my-graph"), RDF.type, ResourceFactory.createTypedLiteral("2", XSDDatatype.XSDdecimal) ); System.out.println(model.listStatements().next().getObject().asLiteral().getLexicalForm()); }); }
The behaviour is as follows:
- When running the code with Jena 5.1.0, it wrongly prints out "2.0"
- When running the code with Jena 5.0.0, it correctly prints out "2"
- When running the code using the in-memory model instead of the TDB one, then with both Jena 5.0.0 and 5.1.0, it correctly prints out "2"
It seems that the problem happens when writing the triple, not when reading it: if the above code is modified and run with Jena 5.0.0 to store, and with Jena 5.1.0 to read the triple, then it correctly prints out "2".
Attachments
Issue Links
- relates to
-
JENA-2360 No result when listing specific statement using TDB
- Open