qudt / qudt-public-repo

QUDT -Quantities, Units, Dimensions and dataTypes - public repository
Other
108 stars 69 forks source link

Add SHACL shapes ensuring correctness of scientific notation values #870

Closed fkleedorfer closed 3 months ago

fkleedorfer commented 3 months ago

Constraints added for

fkleedorfer commented 3 months ago

I actually tried to allow trailing zeroes. There is a case with one trailing zero, which passes, if I am not mistaken... It's one regex that does that. First we have to figure out what behavior we want, then we can change the regex

steveraysteveray commented 3 months ago

Agreed. Let's see what others think. I was going to test adding some non-zeroes beyond the resolution of xsd:double to see if it would pass, but didn't get that far. My thought is that a deviation beyond the resolution of xsd:double is fine. We should consider the xsd:decimal as the "master value", and the xsd:double as a human-readable approximation.

fkleedorfer commented 3 months ago

Here is what I think we all want:

  1. SN is optional
  2. SN is a human-read/writable constraint on the value
  3. Precision is not specified by SN having more or fewer trailing zeroes

Hence, trim trailing zeros behind the decimal point except for the first, in both SN and ctual value before comparing.

steveraysteveray commented 3 months ago

I'm a little unclear on your trimming. Would this be how you might trim?

0.00100 trims to 0.001 1.00E-3 trims to 1.0E-3

...and then you compare?

fkleedorfer commented 3 months ago

That's what I meant

fkleedorfer commented 3 months ago

Updated the shapes to do exactly what's described above:

  1. if there is no SN value: validation passes
  2. Any trailing zeroes of the SN value are disregarded in the comparison
  3. Any trailing zeroes of the decimal value are disregarded in the comparison