Carbon-Farm-Network / app-carbon-farm-network

GNU Affero General Public License v3.0
1 stars 0 forks source link

Add new unit local override labels #37

Open pospi opened 1 year ago

pospi commented 1 year ago

This is not necessary in hREA and will lead to loss of semantic integrity over the long term. For associations made to this unit we can simply assign null instead.

fosterlynn commented 1 year ago

@pospi I'm wondering what is your thinking about this in terms of loss of semantic integrity, and allowing null units?

For sure the label is not helpful, I think I'll try a PR over in OM2.

pospi commented 1 year ago

Well, having a "one" or "each" unit causes loss of semantic integrity because there is no well-defined definition for it and so every network will end up with an incompatible definition that would have to be manually associated with others.

I'm pretty sure this was behind the original decision to make it optional, because then the absence of the value is easily interpreted as semantically equivalent.

pospi commented 1 year ago

Further thoughts: the semantic meaning of "each" and "one" never really made sense anyway. You can't say "I have 5 each apples" or "I have 5 one apples". So any apps using those units always had conditionals coded into the rendering of the language to begin with. "If the unit is 'each', ignore it", kinda dodgy string-matching conditionals.

If the thing is unitless, the measure is the name of the thing. Apples are measured in numbers of apples.

If we simply use a null Unit when there is no measure defined then this becomes terser: eg. in TypeScript you could write I have 5 ${Unit?.symbol} apples which would be substituted with an empty string if Unit === null.

fosterlynn commented 1 year ago

If the thing is unitless, the measure is the name of the thing. Apples are measured in numbers of apples.

Actually, they are not unitless, they have a one-dimensional unit. At least this is how it is talked about in OM2 and in QUDT (which calls it "number"). My only problem is the label "one". People in production situations might talk about "count" or "each". Sensorica used "each" and it was OK for them - they were user defined at that point, and not used in a sentence. In Playspace, we just blanked out the "one" when it was in a sentence structure like your example. So the UI is the tricky part.

In OM2 there is a whole section for the one-dimensional units, here are some snippets from here just for the flavor:

<!-- One Ontology -->

  <om:Unit rdf:about="&om;one">
    <rdfs:label xml:lang="en">one</rdfs:label>
    <om:alternativeLabel xml:lang="en">unit one</om:alternativeLabel>
    <rdfs:comment xml:lang="en">Unit one is a unit of dimension one.</rdfs:comment>
    <om:symbol>1</om:symbol>
    <rdf:type rdf:resource="&om;SingularUnit"/>
    <om:hasDimension rdf:resource="&om;dimensionOne"/>
  </om:Unit>

  <owl:Class rdf:about="&om;QuantityOfDimensionOneUnit">
    <rdfs:label xml:lang="en">quantity of dimension one unit</rdfs:label>
    <rdfs:subClassOf rdf:resource="&om;Unit"/>
    <owl:equivalentClass>
      <owl:Class>
        <owl:oneOf rdf:parseType="Collection">
          <om:Unit rdf:about="&om;one"/>
          <om:Unit rdf:about="&om;percent"/>
          <om:Unit rdf:about="&om;partsPerMillion"/>
          <om:Unit rdf:about="&om;halfDozen"/>
          <om:Unit rdf:about="&om;dozen"/>
          <om:Unit rdf:about="&om;hundredCount"/>
          <om:Unit rdf:about="&om;gross"/>
          <om:Unit rdf:about="&om;thousandPiece"/>
        </owl:oneOf>
      </owl:Class>
    </owl:equivalentClass>
  </owl:Class>        
fosterlynn commented 6 months ago

I've made some changes to the units doc in VF. And also added localLabel and localSymbol so networks can override the OM2 display in their data, but still be using the same unit for interops across networks. Hopefully this solves this kind of issue, and people can override with a space if they like, or maybe an empty string, whatever works. (Not out on the hosted site yet, but merged in the repo. Should be on the website today or tomorrow.)

fosterlynn commented 3 months ago

I've made some changes to the units doc in VF. And also added localLabel and localSymbol

Renamed those in the latest VF. Anyhow, I think this issue can be addressed with upgrading to the latest VF for Unit, and doing a UI that each network can use.