Skip to content

Commit 342b40b

Browse files
author
Jacob Glickman
committed
XSD_DECIMAL representation is no longer canonicalized.
1 parent 8bb1aca commit 342b40b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎core/src/main/java/com/github/jsonldjava/core/RDFDataset.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import static com.github.jsonldjava.core.JsonLdConsts.RDF_REST;
77
import static com.github.jsonldjava.core.JsonLdConsts.RDF_TYPE;
88
import static com.github.jsonldjava.core.JsonLdConsts.XSD_BOOLEAN;
9+
import static com.github.jsonldjava.core.JsonLdConsts.XSD_DECIMAL;
910
import static com.github.jsonldjava.core.JsonLdConsts.XSD_DOUBLE;
1011
import static com.github.jsonldjava.core.JsonLdConsts.XSD_INTEGER;
1112
import static com.github.jsonldjava.core.JsonLdConsts.XSD_STRING;
@@ -665,7 +666,10 @@ private Node objectToRDF(Object item) {
665666
return new Literal(Float.toString((float) value),
666667
datatype == null ? XSD_DOUBLE : (String) datatype, null);
667668
} else {
668-
// canonical double representation
669+
// Only canonicalize representation if datatype is not XSD_DECIMAL
670+
if (XSD_DECIMAL.equals(datatype)) {
671+
return new Literal(value.toString(), XSD_DECIMAL, null);
672+
}
669673
final DecimalFormat df = new DecimalFormat("0.0###############E0");
670674
df.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.US));
671675
return new Literal(df.format(value),

0 commit comments

Comments
 (0)