@@ -376,6 +376,10 @@ def unicodeExpand(m: Match) -> str:
376
376
langcode = re .compile (r"[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" )
377
377
378
378
379
+ class sfloat (str ):
380
+ """ don't normalize raw XSD.double string representation """
381
+
382
+
379
383
class SinkParser :
380
384
def __init__ (
381
385
self ,
@@ -1522,7 +1526,7 @@ def nodeOrLiteral(self, argstr: str, i: int, res: MutableSequence[Any]) -> int:
1522
1526
m = exponent_syntax .match (argstr , i )
1523
1527
if m :
1524
1528
j = m .end ()
1525
- res .append (float (argstr [i :j ]))
1529
+ res .append (sfloat (argstr [i :j ]))
1526
1530
return j
1527
1531
1528
1532
m = decimal_syntax .match (argstr , i )
@@ -1913,15 +1917,15 @@ def normalise(self, f: Formula | Graph | None, n: int) -> Literal: ...
1913
1917
def normalise (self , f : Formula | Graph | None , n : Decimal ) -> Literal : ...
1914
1918
1915
1919
@overload
1916
- def normalise (self , f : Formula | Graph | None , n : float ) -> Literal : ...
1920
+ def normalise (self , f : Formula | Graph | None , n : sfloat ) -> Literal : ...
1917
1921
1918
1922
@overload
1919
1923
def normalise (self , f : Formula | Graph | None , n : Node ) -> Node : ...
1920
1924
1921
1925
def normalise (
1922
1926
self ,
1923
1927
f : Formula | Graph | None ,
1924
- n : Union [tuple [int , str ], bool , int , Decimal , float , Node , _AnyT ],
1928
+ n : Union [tuple [int , str ], bool , int , Decimal , sfloat , Node , _AnyT ],
1925
1929
) -> Union [URIRef , Literal , BNode , Node , _AnyT ]:
1926
1930
if isinstance (n , tuple ):
1927
1931
return URIRef (str (n [1 ]))
@@ -1941,7 +1945,7 @@ def normalise(
1941
1945
s = Literal (value , datatype = DECIMAL_DATATYPE )
1942
1946
return s
1943
1947
1944
- if isinstance (n , float ):
1948
+ if isinstance (n , sfloat ):
1945
1949
s = Literal (str (n ), datatype = DOUBLE_DATATYPE )
1946
1950
return s
1947
1951
0 commit comments