This wiki has undergone a migration to Confluence found Here
<meta name="googlebot" content="noindex">

Datatypes R2 Issue 99

From HL7Wiki
Jump to navigation Jump to search

Clarification of Semantics on QTY

Disposition

Added QTZ, added dividedBy where possible, clarified a few invariants

Skype

it seems to me that there is some semantics missing from the abstract datatypes. [6:20:37 AM] Grahame Grieve says: MO.divides [6:22:29 AM] Grahame Grieve says: MO.negated [6:22:52 AM] Grahame Grieve says: no sorry, that exists [6:23:52 AM] Grahame Grieve says: in fact, divides generally across qty where it applies [6:24:29 AM] Grahame Grieve says: we only discuss whole number division on INT. We should describe divides where we discuss times - like we discuss minus where we discuss plus [6:28:08 AM] Grahame Grieve says: I cannot get comfortable with the fact that BIN is a LIST<BL> [6:28:52 AM] Grahame Grieve says: at the very least, we should make a rule that BIN.length.remainder(8).isZero [6:29:38 AM] Grahame Grieve says: what TS is it where x.isZero? [6:30:14 AM] Grahame Grieve says: I think this is a logical impossibility, since you can't subtract a TS from itself [6:31:13 AM] Grahame Grieve says: Tom Beale resolved this by having two abstract quantities, and TS derives from the simpler one [6:32:05 AM] Grahame Grieve says: INT.times(REAL) we should discuss to [6:32:28 AM] Grahame Grieve says: and INT.asREAL [11:00:57 AM] Gunther Schadow says: a.dividedBy(b).equals(a. times(b.inverted)) I'm sure we say that and that is all there is to say. [11:01:47 AM] Gunther Schadow says: at the very least, we should make a rule that BIN.length.remainder(8).isZero, why? I have a 12 bit machine in my basement (PDP-8) is it incompatible with v3dt abstract? It should not be. [11:05:14 AM] Gunther Schadow says: what TS is it where x.isZero? Hmm, interesting question. It's not Jesus' birthday. Neither the Higra. It must be calendar independent. And there is no such thing as zero time. Beginning of the universe? It just doesn't seem to exist independently of a calendar. Strange. [11:05:33 AM] Gunther Schadow says: (think) [11:07:27 AM] Gunther Schadow says: I think this is a logical impossibility, since you can't subtract a TS from itself, why not? That is simple. Result is 0 s (a PQ). No problem here. Since two TS can't be added, there is no neutral element of addition. What is that kind of algebraic structure called that doesn't even have a plus operation??? [11:08:08 AM] Gunther Schadow says: Tom Beale resolved this by having two abstract quantities, and TS derives from the simpler one -- could be considered. [11:09:27 AM] Gunther Schadow says: INT.times(REAL) does not exist. Neither does REAL.times(INT). Only ((REAL)n).times(r) with INT n and REAL r, and r.times((REAL)n). [11:10:09 AM] Gunther Schadow says: INT.asREAL ... why should INT know about the existence of REAL? Should not rater REAL know something about INTs, it already does anyway. [1:08:13 PM] Grahame Grieve says: a.dividedBy(b).equals(a. times(b.inverted)) - we do not say this. and for the only dividedBy that we define - INT - it is not true [1:08:22 PM] Grahame Grieve says: I don' [1:08:49 PM] Grahame Grieve says: I don't care about your stupid defunct PDP-8. Do I need to support 12 bit streams because you have one? [1:09:40 PM] Grahame Grieve says: there is no isZero for TS. And you can't subtract one TS from another, because you can only subtract PQ's from TS. so result is not 0(PQ) [1:10:17 PM] Grahame Grieve says: ok INT.asReal may not be needed since REAL has the promotion [1:10:56 PM] Grahame Grieve says: duh. stupid. you can subtract ts from ts. what am I thinking. [1:11:34 PM] Grahame Grieve says: but still, isZero does not exist for TS [1:11:39 PM] Gunther Schadow says: I see. That's right. I did not put operations into v3dt if they were not needed to define things. No utilities are there. Because a.dividedBy(b).equals(a. times(b.inverted)) is so simple, I didn't put it in. Of course I did put it into JavaSIG. [1:11:45 PM] Grahame Grieve says: though: invariant(QTY x) {

  x.minus(x).isZero;

}; [1:12:11 PM] Gunther Schadow says: I don't care about your stupid defunct PDP-8. Do I need to support 12 bit streams because you have one? -- what do you gain by your stupid 8 bit constraint? [1:12:42 PM] Grahame Grieve says: well assures everyone they can be stupid and only support 8 bit bytes. [1:13:12 PM] Grahame Grieve says: though: invariant(QTY x) {

  x.minus(x).isZero;

}; [1:13:32 PM] Grahame Grieve says: what does that mean for TS when x.minus(x) is not a PQ? don't know [1:13:45 PM] Gunther Schadow says: There are no bytes in the abstract spec. They are not needed. There is nothing to support about it. [1:14:19 PM] Grahame Grieve says: what does that mean for TS when x.minus(x) is not a TS? don't know (stupid typo) [1:15:21 PM] Gunther Schadow says: I just remembered that I've been thru this with JavaSIG. [1:15:37 PM] Gunther Schadow says: Check this out: http://aurora.regenstrief.org/~javasig/apidoc/org/hl7/types/QTY.html [1:16:20 PM] Gunther Schadow says: QTY has very few operations. QTY.diff only has isZero and a plus for itself. [1:16:59 PM] Gunther Schadow says: I think that's solved then. [1:17:35 PM] Grahame Grieve says: really? I just read that and I'm not illuminated as to why it's relevant [1:17:46 PM] Gunther Schadow says: What? [1:18:15 PM] Grahame Grieve says: the apidoc. why is it useful here? [1:18:58 PM] Grahame Grieve says: gotto go. back later [1:19:43 PM] Gunther Schadow says: Forget about the text. It's about the definitions. QTY here has no isZero, and TS is a QTY. INT and REAL are QTY.diff, and have isZero. It solves the issue. [1:23:01 PM] Grahame Grieve says: gotcha. So we make the change for that?