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
DB 5.1__DEV11: unit support for time #3099
Conversation
This commit introduces the ome.model.unit.Time class which contains a double value and a string unit for representing time durations. The only location which makes use of this is PlaneInfo.exposureTime. "ms" is hard-coded until the xsd-fu unit support is in place.
Travis isn't green. |
@@ -1669,6 +1669,7 @@ | |||
id int8 not null, | |||
deltaT float8, | |||
permissions int8 not null, | |||
exposureTimeUnit varchar(255), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
255 seems a bit wasteful; can't we use a much smaller size here given that most unit symbols and/or names will be very small?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another possibility on the db side would be to have a foreign key reference to a time units table to make it restricted to the model enum values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, but that's something we should do across the board in another PR, since we don't have any support for that at the moment. More interesting to me would be whether or not this should actually be an enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For any code to be able to robustly cope with units, I consider an enum as a necessity. This does constrain which units are possible to use of course, but the set Andrew has created covers all the SI system and then some, so I think the number of cases where this won't be sufficient is approaching zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, this was mostly just to have an example of touching all the necessary pieces. Just chatted through the current ome.xml
classes that are needed:
class PlaneInfo {
Time exposureTime;
}
class Time {
double value;
UnitsTime unit;
}
class UnitsTime {
String symbol;
String measurementSystem.
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: what I'd really like would be to have:
enum UnitsTime {
}
but we don't currently have support for that in Hibernate and the DB. It might be worth it though.
Grrr.....
|
Also adds the TimeI implementation for the Python and C++ language bindings, including object factories and IceMapper code. The Java implementation is also an implementor of `ModelBased` so that IceMapper can convert back and forth to ome.model.units instances. For the next unit implementation (i.e. `Length`), it will likely be better to introduce code generation of the `ome.model.units` implementations rather than hand-writing them. Note: a workaround was needed for the generation of unique constant names in Ice since constants must vary in more than just capitalization which fails for SI prefixes like M and m.
--depends-on ome/bioformats#1379 |
Added dependency on the units work from @qidane, removed |
4d99186
to
48697b2
Compare
This commit adds an implicit dependency on the updated schema. Since there planeInfo.deltaT and pixels.timeIncrement have been modified to type Time, that takes place here as well. Note: this runs into an issue with hibernate (HHH-4329) in which the nice foreign key naming for embedded objects has to be removed. I'll attempt fixing that elsewhere. --depends-on ome/bioformats#1265
The few unit types are now corrected by hand since there is currently no way to code generate them. The map types were also missing properly named FKs, but these could be handled by the introduction of a new annotation. Note: a check has now been added to travis-build which should prevent generated FK constraint names from being included in a schema.
Java's FileReader and FileWriter use the default local encoding which led to some .ice files being created with latin1 encoding. Ice then understandably couldn't handle the micro symbol failing the build. See: http://stackoverflow.com/questions/6998905/java-bufferedwriter-object-with-utf-8
Ant's `<copy>` task uses the default encoding as well, meaning that the splitting of the combined file which DSLTask created with UTF-8 converted back to LATIN1 when the locale was C or similar. Further, charAt was not sufficient for detecting the micro symbol under C and so codePointAt is now used.
Restarted travis due to HDF5 weirdness. For everyone's benefit, decision was to disable the tests for the moment (https://trac.openmicroscopy.org.uk/ome/ticket/12601) and look into this as a fix post m2. |
This and ome/bioformats#1379 are no longer in the breaking queue. |
This broke web on trout with InternalException at /webclient/load_data/dataset/7751/
exception ::omero::InternalException
{
serverStackTrace = ome.conditions.InternalException: Wrapped Exception: (org.springframework.orm.hibernate3.HibernateSystemException):
Null value was assigned to a property of primitive type setter of ome.model.units.Time.value; nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of ome.model.units.Time.value
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679) |
deleted my comment. I was using an out-of-date client |
I did not notice the web error when starting the tests with an empty DB
|
cc @will-moore |
If you can see what the upgrade script is failing to do, I am happy to try to patch it. |
The issue is with the update script: so far tested upgrade from patch 10 to patch 11
No issue for images imported after applying the patch |
Pixels table:
PlaneInfo:
Error in the script for planeInfo |
Closing this PR so it can move out of the breaking queue. |
Re-opening after closing gh-3129 so I can push a few more commits. |
Thanks all. Merging. |
DB 5.1__DEV11: unit support for time
--no-rebase |
This commit introduces the ome.model.unit.Time class
which contains a double value and a string unit for
representing time durations. The only location which
makes use of this is PlaneInfo.exposureTime. "ms" is
hard-coded until the xsd-fu unit support is in place.
/cc @bpindelski @mtbc @qidane @rleigh-dundee