qudt / qudt-public-repo

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

Fix qudt:hasDimensionVector entries #833

Closed fkleedorfer closed 7 months ago

fkleedorfer commented 7 months ago

For each fix, a comment is provided that contains the 'factor unit tree' along with the dimension vectors of each the factor, so that reviewers can check the combination of those vectors and verify the error in the existing DV. These comments should be removed after verification of the replaced DVs.

All other dimension vectors are correct or cannot be verified because their factor units' dimension vectors are missing.

steveraysteveray commented 7 months ago

I now realize that we have a cascading set of errors. You have fixed the unit's dimension vector, but now of course, the associated quantity kind either

  1. Is the correct quantity kind, but it also has the wrong dimension vector, or
  2. Is the wrong quantity kind.

Would you be willing to chase these down? They show up in the validation check.

steveraysteveray commented 7 months ago
image image
steveraysteveray commented 7 months ago

I will be reverting this merge so that we get back to the previous commit.

fkleedorfer commented 7 months ago

Yep I was expecting things to break this way - sorry I should have mentioned it.

fkleedorfer commented 7 months ago

The algorithm is simple once you have the factor unit hierarchy: take the dim vector to the power of the unit, combine vectors in the parent node, and continue that recursively.

I am doing this in java, it is probably doable with shacl sparql functions and the preprocessing I am doing with a couple of construct queries and a few extra triples. However, I don't have the time to do that now. Feel free to use qudtlib to do it though ( release with that code in the next few days)

fkleedorfer commented 7 months ago

For the more pressing problem at hand - fixing the quantity kinds - what is the algorithm?

  1. If the qk is not associated with another unit, change the dv of the qk Else
  2. If there is another unit with the same dv as this unit use its qk Else
  3. Invent a new qk or use unknown

...keeping an eye open for something being obviously wrong that might affect the algorithm

Makes sense?

steveraysteveray commented 7 months ago

There seems to be a problem with your factor logic. For example, you had:

  # factor unit tree for unit µg/cm²
  #     +-- unit:MicroG-PER-CentiM2         http://qudt.org/vocab/dimensionvector/A0E0L-2I0M1H0T0D0
  #     |   +-- unit:MicroG                     http://qudt.org/vocab/dimensionvector/A0E0L1I0M0H0T-2D0
  #     |   +-- unit:CentiM^-2                  http://qudt.org/vocab/dimensionvector/A0E0L-2I0M0H0T0D0
  #
  qudt:hasDimensionVector qkdv:A0E0L-1I0M0H0T-2D0 ;
steveraysteveray commented 7 months ago

Aha, I now see that we had an error in the URI: MicroG-PER-CM2 should have been MicroGM-PER-CM2. Your algorithm took it at face value and assumed we were talking about MicroGravity per cm**2, and thus computed the appropriate DV.

So we should fix that first, and then tackle the cascading issues. It may be that the qk algorithm may need to involve a human to make the judgements... I can't go any further right now - maybe tomorrow.

fkleedorfer commented 7 months ago

I caught two more of such cases earlier, but this one slipped through. See #834

I'll remove this dv replacement from this PR.

steveraysteveray commented 7 months ago

How about making the changes (including the qk updates where needed) and create a new PR for all this?

fkleedorfer commented 7 months ago

I've added some information about the quantitykinds - does not seem to be an easy decision in each case

PR: #836

fkleedorfer commented 7 months ago

No, actually: #837