-
Notifications
You must be signed in to change notification settings - Fork 576
Closed
Description
From the turtle spec [1]:
Data Type | Abbreviated | Lexical | Description |
---|---|---|---|
xsd:integer | -5 | "-5"^^xsd:integer | Integer values may be written as an optional sign and a series of digits. Integers match the regular expression "[+-]?[0-9]+". |
xsd:decimal | -5.0 | "-5.0"^^xsd:decimal | Arbitrary-precision decimals may be written as an optional sign, zero or more digits, a decimal point and one or more digits. Decimals match the regular expression "[+-]?[0-9]*.[0-9]+". |
xsd:double | 4.2E9 | "4.2E9"^^xsd:double | Double-precision floating point values may be written as an optionally signed mantissa with an optional decimal point, the letter "e" or "E", and an optionally signed integer exponent. The exponent matches the regular expression "[+-]?[0-9]+" and the mantissa one of these regular expressions: "[+-]?[0-9]+.[0-9]+", "[+-]?.[0-9]+" or "[+-]?[0-9]". |
Testing this, I get:
>>> rdflib.util.from_n3("-5")
rdflib.term.BNode('-5')
>>> rdflib.util.from_n3("-5.0")
rdflib.term.BNode('-5.0')
>>> rdflib.util.from_n3("4.2E9")
rdflib.term.BNode('4.2E9')
It does seem to work on positive integers:
>>> rdflib.util.from_n3("5")
rdflib.term.Literal('5', datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#integer'))
Metadata
Metadata
Assignees
Labels
No labels