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:
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:
… 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 ] .