Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SHACL shapes ensuring correctness of scientific notation values #870

Merged
merged 5 commits into from
Mar 11, 2024

Conversation

fkleedorfer
Copy link
Collaborator

Constraints added for

  • qudt:conversionMultiplier(SN)
  • qudt:conversionOffset(SN)
  • qudt:value(SN)
  • qudt:standardUncertainty(SN)

Constraints added for
- qudt:conversionMultiplier(SN)
- qudt:conversionOffset(SN)
- qudt:value(SN)
- qudt:standardUncertainty(SN)
Copy link
Collaborator

@steveraysteveray steveraysteveray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the new properties and property shapes to the OWL and SHACL schema files.

One observation: I tried adding a bunch of zeroes at the end of the decimal value of a ConstantValue, and the validation fails. I have not examined the mechanism of your validation rules - just the behavior. Is there a way to make it pass in that case? I suppose the counter-argument is the implied precision of the trailing zeroes... I'd welcome everybody's thoughts on this.

@fkleedorfer
Copy link
Collaborator Author

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
Copy link
Collaborator

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.

Copy link
Collaborator

@ralphtq ralphtq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following discussion with Steve the decimal values should be treated as the definitive values. Should the scientific value be relied on to a specific number of digits, that is, up to 16 digits? The SN value is really intended for human consumption and not for calculation. Therefore we should not insist on strict matching on trailing zeros. Or any number beyond 16 digits. @fkleedorfer thoughts?

@fkleedorfer
Copy link
Collaborator Author

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
Copy link
Collaborator

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
Copy link
Collaborator Author

That's what I meant

@fkleedorfer
Copy link
Collaborator Author

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

…notation value

Ignoring trailing zeroes was not working properly before this commit.
@steveraysteveray steveraysteveray merged commit 9635912 into main Mar 11, 2024
@steveraysteveray steveraysteveray deleted the feature/shacl-for-scientific-notation branch March 11, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants