rdfsemantic-webowlunits-of-measurementlinked-data

units of measurement in owl and rdf


I'm creating linked data of materials and their physical properties, and I'm having trouble with setting units for certain properties. My individual material :AlMg3 has some mechanical properties like:

:AlMg3 prop:hasTensileStrength "300" .
:AlMg3 prop:hasYieldStrength   "2" .
:alMg3 prop:hasDensity         "2200" .

How to put units for that values? My first idea was to make new datatypes, e.g.:

unit:megaPascal rdf:type   rdfs:datatype ;
                rdfs:label "MPa" .

unit:Pascal rdf:type   rdfs:datatype ;
                rdfs:label "Pa" .

and then use them like this:

:AlMg3 prop:hasTensileStrength "300"^^unit:megaPascal .
:AlMg3 prop:hasYieldStrength   "2"^^unit:Pascal .

Then I'd want to relate these units like this:

unit:megaPascal prop:hasBaseUnit   unit:Pascal .
unit:pascal     prop:hasBaseSIUnit unit:kilogramPerMeterSecondSquared .

Is this possible? The units would be datatypes, and I can't put datatype properties between them, except for annotation properties? Is it possible to make those units individuals (or even classes) and use them like that a datatype after some value?

I saw OWL ontologies for QUDT (Quantities, Units, Dimensions and Data Types), but I was going to try to create something simpler myself.


Solution

  • You can use whatever datatypes you like, but the problem if you do that (e.g., using "300"^^unit:megaPascal) is that you can no longer do arithmetic on them, and you can't get any validation of the lexical forms from any of the standard tools. Better options are to add some documentation to your properties and use literals with supported datatypes, or use some structured values for these measurements.

    Documentation and standard datatypes

    What is probably makes more sense to do is just add a comment to the relevant properties that their values should be specified as numbers in some particular unit. E.g.,

    prop:hasYieldStrength rdfs:comment "YieldStrength of material in Pascals"@en .
    

    Structured values (perhaps using rdf:value)

    The other option is to make the range of those properties some sort of entity that specifies both the measurement and the unit, so that your data would be like:

    :AlMg3 prop:hasTensileStrength [ rdf:value "300"^^xsd:integer ;
                                     unit:units unit:megaPascal ] .
    

    If you're working in OWL, I'm not sure whether it's OK to use rdf:value or not, but you can certainly use your own vocabulary to do the same thing. If you can use rdf:value, this is actually one the ways that the the RDF documentation says it can be used:

    5.4.3 rdf:value

    rdf:value is an instance of rdf:Property that may be used in describing structured values.

    rdf:value has no meaning on its own. It is provided as a piece of vocabulary that may be used in idioms such as illustrated in example 16 of the RDF primer [RDF-PRIMER]. Despite the lack of formal specification of the meaning of this property, there is value in defining it to encourage the use of a common idiom in examples of this kind.

    The RDF Primer has relevant material too; measurements are one of the explicit examples:

    4.4 More on Structured Values: rdf:value

    … For instance, in Example 9 in Section 3.2, the weight of a particular tent was given as the decimal value 2.4 using a typed literal, i.e.,

    exproduct:item10245   exterms:weight   "2.4"^^xsd:decimal .
    

    In fact, a more complete description of the weight would have been 2.4 kilograms rather than just the decimal value 2.4. To state this, the value of the exterms:weight property would need to have two components, the typed literal for the decimal value and an indication of the unit of measure (kilograms). In this situation the decimal value could be considered the "main" value of the exterms:weight property, because frequently the value would be recorded simply as the typed literal (as in the triple above), relying on an understanding of the context to fill in the unstated units information.

    In the RDF model a qualified property value of this kind can be considered as simply another kind of structured value. To represent this, a separate resource could be used to represent the structured value as a whole (the weight, in this case), and to serve as the object of the original statement. That resource could then be given properties representing the individual parts of the structured value. In this case, there should be a property for the typed literal representing the decimal value, and a property for the unit. RDF provides a predefined rdf:value property to describe the main value (if there is one) of a structured value. So in this case, the typed literal could be given as the value of the rdf:value property, and the resource exunits:kilograms as the value of an exterms:units property (assuming the resource exunits:kilograms is defined as part of example.org's vocabulary). The resulting triples would be:

    exproduct:item10245   exterms:weight   _:weight10245 .
    _:weight10245         rdf:value        "2.4"^^xsd:decimal .
    _:weight10245         exterms:units    exunits:kilograms .
    

    Note that that last example can be written as:

    exproduct:item10245 exterms:weight [ rdf:value "2.4"^^xsd:decimal ;
                                         exterms:units exunits:kilograms ] .