-
Notifications
You must be signed in to change notification settings - Fork 1
Home
(See initial modeling discussion here)
We are basically going to implement the following conversion approach.
An instance of the Unit
class captures one main unit entry in the XML. It may have a primary name (via property hasName
) and zero or more aliases (via hasAlias
property).
This is a functional property to capture the <def>
element from the XML description.
This is a functional property that indicates the primary name of a given Unit
instance. In particular, a unit may not have a primary name.
Indicates an alternate name for a given Unit
instance. A unit can have zero or more aliases associated.
Indicates a symbol associated with a given Unit
instance. A unit can have zero or more symbols associated.
Instances of the UnitName
class capture a name or alias associated with an instance of a class Unit
.
With UnitName
as domain, this functional property indicates the Unit
instance associated with the name.
With UnitName
as domain, this functional property indicates whether the name is "singular"
or "plural"
.
Remarks:
- The approach clearly separates the concept of unit from any associated specific names/aliases.
- Those names/aliases will have URIs per se (so they could be self-resolvable)
Instances of the Prefix
class capture a prefix that can be used in front of any instance of class Unit
.
This is a functional property to capture the <value>
element from the XML description, which defines the mathematical value of the prefix..
This property that indicates the name of a given Prefix
instance; unlike hasName
, the object of hasPrefixName is a string. (Prefix names are not presented as independent terms.)
Indicates a symbol associated with a given Prefix
instance. A prefix can have one or more symbols associated.
The Unit
, UnitName
, and Prefix
instance URIs will share the same namespace. The id part for each UnitName
instance will simply be the associated name itself; this is appropriate because these names are both user- and web-friendly.
The Unit
case needs some extra handling. First, all units must have <def>
strings, so we will use these strings as basis for an identification term. Although the primary names would be a good candidate for identification, some units lack such names. Moreover, even if such names were always available, we need to avoid collision with the corresponding UnitName
instances that would also get those names for its identification, unless we put those on a different namespace.
So, for the generation of Unit
instances, the conversion tool will apply an arbitrary but deterministic translation (md5 or sha hash) of the <def>
string, and use the last 6 characters. If a collision results, the tool will add a '+' to the string and re-hash and repeat until a unique name results.
The Prefix
case follows the Unit
case, but using the <value>
string as the basis for the identification term.
The following entry from the original vocabulary:
<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 result in the RDF representation:
@prefix : <http://mmisw.org/ont/mmitest/udunits2-accepted/> .
@prefix prop: <http://mmisw.org/ont/mmitest/udunits2-prop/> .
:2a1369
a :Unit ;
prop:hasDefinition "'/60" ;
prop:hasName :arc_second ;
prop:hasAlias :arcsec, :angular_second, :arcsecond ;
prop:hasSymbol "\"", "″" ;
:arc_second
a :UnitName ;
prop:namesUnit :2a1369;
prop:hasCardinality "singular";
:arcsec
a :UnitName ;
prop:namesUnit :2a1369;
prop:hasCardinality "singular";
:angular_second
a :UnitName ;
prop:namesUnit :2a1369;
prop:hasCardinality "singular";
:arcsecond
a :UnitName ;
prop:namesUnit :2a1369;
prop:hasCardinality "singular";
<unit>
<!-- The following is exact. From 1901 to 1964, however, 1
liter was 1.000028 dm^3 -->
<def>dm^3</def> <!-- exact -->
<name><singular>liter</singular></name>
<symbol>L</symbol> <!-- NIST recommendation -->
<aliases>
<name><singular>litre</singular></name>
<symbol>l</symbol>
</aliases>
</unit>
will result in the RDF representation:
@prefix : <http://mmisw.org/ont/mmitest/udunits2-accepted/> .
@prefix prop: <http://mmisw.org/ont/mmitest/udunits2-prop/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:_4b023412
a :Unit ;
prop:hasDefinition "dm^3" ;
prop:hasName :liter ;
prop:hasAlias :litre ;
prop:hasSymbol "L", "l" ;
rdfs:comment "The following is exact. From 1901 to 1964, however, 1 liter was 1.000028 dm^3" ;
prop:hasSymbolComment "NIST recommendation" .
:liter
a :UnitName ;
prop:namesUnit :_4b023412;
prop:hasCardinality "singular".
:litre
a :UnitName ;
prop:namesUnit :_4b023412;
prop:hasCardinality "singular".
Any other questions?