OWL Rational

From OWL
Jump to: navigation, search

Draft proposal for basic real number support in OWL 1.1

(Proposed resolution to Issue-87)

This document describes a datatype proposed for standardization in OWL 1.1

In accordance with RDF Concepts and Abstract Syntax a datatype must have a lexical space, a value space, and a lexical-to-value mapping.

A URI reference for identifying this datatype is http://@@@@/@#real

The value space of real is the set of real numbers and ordered as usual.

The lexical space will allow us to address the rationals directly, and is defined in the rational production below, using the standard BNF notation (reusing syntax and definitions from Syntax)

numerator := [ '-' ] digit { digit }
denominator := nonzero { digit }
rational := numerator [ '/' denominator ]

For example -1/3, 41/7, 0/19, 4/2, -6/1, 0, 2, and -6 are all legal literals for rational.

The lexical-to-value mapping is defined as follows. If the '/' and denominator are present in a literal in the lexical space, the literal maps to the value in the value space obtained by calculating the ratio of the integers represented by the numerator and denominator productions. If the '/' and denominator are absent in a literal in the lexical space, the literal maps to the integer represented by the numerator.


The lexical-to-value mapping is a many-to-one mapping and does not get all reals (which is ok according to Syntax), i.e., reals like "pi" that are not rationals cannot be addressed. The reason for there being many values in the value space for which there is no string in the lexical space is two-fold: (i) if we only allow for rational numbers in the value space, then, following a modification of an example of Pascal Hitzler, the following example class of smallSquares would be unsatisfiable:

strangeSquare: all squares with sideLength*sideLength = 2

(ii) amongst all real numbers, there are uncountably many numbers that are not rational, and thus cannot be described by the above "nominator/denominator" pattern, and thus we cannot introduce names for all of them, even if we wanted.

Finally, this proposed datatype is closely related to xsd:float and xsd:decimal, hence the question arises why we want or need it. The answer is that we can use the rational constants to represent values exactly, avoid rounding, and thus to precisely compare numbers.