Open VladimirAlexiev opened 1 month ago
Thanks, We have created a ticket in order to fix this bug.
- this doesn't allow 0 to appear in multi-digit numbers, eg 109 and 100 are not allowed
...
If you want to limit to 0..999 then use sh:minInclusive. maxExclusive. Don't use sh:pattern
I am not sure to understand why this pattern rejects 109
and 100
. It can be simplified as ([1-9]\d{3}|[1-9]\d{2}|[1-9]\d{1}|[0-9])
-> ([1-9]\d{1,3}|\d)
-> \d
which is valid if the string contains at least one digit.
Is the wanted regex ^([1-9]\d{1,3}|\d)$
whichs allows every integer between 0 and 9999 ?
Looks like the type should be xsd:integer
with sh:minExclusive 0
@StephaneBranly You're right, 0 is allowed in the middle.
But surely the length of a siding can be a fractional number: so I think it should stay as xsd:double
.
There's no need to worry about leading zeros because according to RDF semantics they don't matter. Eg try at https://sparql.org/sparql.html, the two literals are equal:
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select ("012"^^xsd:double="12"^^xsd:double) {}
If you need to prevent leading zeros, the best is to use an explicit pattern like this
sh:pattern "^[^0]"
If you want to limit to 0..999 then use sh:minInclusive. maxExclusive. Don't use sh:pattern