-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Is there a schema somewhere?
Here are some unit
definitions found in the XML files:
(1) Typical simple definition:
<unit>
<def>60 min</def>
<name><singular>hour</singular></name>
<symbol>h</symbol>
<aliases> <symbol>hr</symbol> </aliases>
</unit>
(2) Multiple aliases:
<unit>
<def>°/60</def> <!-- DEGREE SIGN -->
<name><singular>arc_minute</singular></name>
<symbol>'</symbol>
<symbol>′</symbol> <!-- PRIME -->
<aliases>
<name><singular>angular_minute</singular></name>
<name><singular>arcminute</singular></name>
<name><singular>arcmin</singular></name>
</aliases>
</unit>
Note that multiple <symbol>
s appear at first level.
(2) Alias with only associated symbol:
<unit>
<def>V/A</def>
<name><singular>ohm</singular></name>
<symbol>Ω</symbol> <!-- Greek capital letter omega
(preferred) -->
<aliases>
<symbol>Ω</symbol> <!-- OHM SIGN -->
</aliases>
</unit>
In this case, why not simply move <symbol>Ω</symbol>
to the first level as in other cases?
-
Define class Unit
-
Define properties for "hasDefinition", "hasAlternate", "hasSymbol", "hasCardinality":
- hasDefinition: string
- hasAlternate: Unit
- hasSymbol: string
- hasCardinality: "singular" | "plural"
-
Each unit name from the XML definitions will be captured in a corresponding instance of the class Unit.
-
For this purpose, these extracted names are: all explicit names (singular and plural), all aliases (singular and plural) from the unit definition
-
With all names associated to a particular
<unit>
definition, the corresponding Unit instances are related to each using the "hasAlternate" property.
The following XML unit definition:
<unit>
<def>'/60</def>
<name><singular>arc_second</singular></name>
<symbol>"</symbol>
<symbol>″</symbol> <!-- DOUBLE PRIME -->
<aliases>
<name><singular>angular_second</singular></name>
<name><singular>arcsecond</singular></name>
<name><singular>arcsec</singular></name>
</aliases>
</unit>
Will generate the following RDF Unit instances:
@prefix : <http://mmisw.org/ont/mmitest/udunits2-accepted/> .
@prefix prop: <http://mmisw.org/ont/mmitest/udunits2-prop/> .
:arc_second
a :Unit ;
prop:hasCardinality "singular";
prop:hasAlternate :arcsec , :angular_second , :arcsecond ;
prop:hasDefinition "'/60" ;
prop:hasSymbol "\"" , "″" .
:arcsec
a :Unit ;
prop:hasCardinality "singular";
prop:hasAlternate :arc_second , :angular_second , :arcsecond ;
prop:hasDefinition "'/60" ;
prop:hasSymbol "\"" , "″" .
:angular_second
a :Unit ;
prop:hasCardinality "singular";
prop:hasAlternate :arc_second , :arcsec, :arcsecond ;
prop:hasDefinition "'/60" ;
prop:hasSymbol "\"" , "″" .
:arcsecond
a :Unit ;
prop:hasCardinality "singular";
prop:hasAlternate :arc_second , :arcsec, :angular_second ;
prop:hasDefinition "'/60" ;
prop:hasSymbol "\"" , "″" .
Note that although the example above explicitly reflects all associated properties for each Unit instance, not all of these would need to be actually materialized internally as some of this information could be inferred with appropriate modeling. More concretely:
- One "master" Unit instance is designated to have all characterization explicitly associated including links to all its alternate names via the
prop:hasAlternate
property, which is symmetric. - Each of the other instances will basically only indicate
prop:hasCardinality
.