egonw / jqudt

Java library for working with the QUDT ontology and data using it.
Other
14 stars 8 forks source link

Available units #4

Closed LeebPhil closed 3 years ago

LeebPhil commented 3 years ago

Hey guys

i wanted to ask which units are currently available. Because in my project i would need units like centimeters, meters, kilometers, m-per-sec, km-per-hours, m-per-sec2 and some others. Are these examples currently available?

Kind regards Phil

egonw commented 3 years ago

You can find all supported units in this file: https://github.com/egonw/jqudt/blob/master/src/main/resources/onto/unit

LeebPhil commented 3 years ago

Thanks, i've now tried to get one of the units for two days, but can't get it done.
Could you please provide an example on how to get one of these units?

Kind regards
Phil

egonw commented 3 years ago

What do you mean with "get one of the units" ?

LeebPhil commented 3 years ago

Just like in your example:

Quantity obs = new Quantity(0.1, ConcentrationUnit.MICROMOLAR);
System.out.println(obs + " = " +  obs.convertTo(ConcentrationUnit.NANOMOLAR));

I don't understand how the parameter has to look like in

Unit unit = UnitFactory.getInstance().getUnit("onto/unit");
LeebPhil commented 3 years ago

Found the solution to my problem, should have been
Unit unit = UnitFactory.getInstance().getUnit("http://qudt.org/vocab/unit#Centimeter") because it is named #Centimeter in https://github.com/egonw/jqudt/blob/master/src/main/resources/onto/unit while it is named CentiM here http://qudt.org/vocab/unit/CentiM
That confused me a lot.

egonw commented 3 years ago

Sorry, I have been really busy, and currently cannot keep up with all the work. I would need to check, but I'm fairly sure the version of QUDT that I have is too old, but haven't been able to pin down the changes with the newer QUDT releases :/

steveraysteveray commented 3 years ago

Hi. I'm involved in QUDT and indeed you are using a fairly old release. The latest official Release is 2.1.11.

Also, a while back we developed a grammar for unit URIs, documented here, which is why Centimeter is now CentiM.

Let me know if you have any more questions about QUDT. It's great that you have developed this Java library!

LeebPhil commented 3 years ago

Hi. I'm involved in QUDT and indeed you are using a fairly old release. The latest official Release is 2.1.11.

Also, a while back we developed a grammar for unit URIs, documented here, which is why Centimeter is now CentiM.

Let me know if you have any more questions about QUDT. It's great that you have developed this Java library!

Correct me please if i got wrong, it means that the namings of units needs to be updated and maybe updating 'properties' of a unit?

steveraysteveray commented 3 years ago

Actually, a lot has improved over the past year. See here for a summary and here for our wiki.