The Component Library distinguishes two kinds of properties: categorical properties and scalar/cardinal properties.
Categorical properties have symbolic values that do not sensibly appear on any scale or continuum. There is no ordering to the values of categorical properties. For example, the color property is categorical. There is no natural ordering of its symbolic values: *blue, *orange, etc. Although it is possible to assign arbitrary numeric values to the symbolic constants (such as the RGB encoding of colors), it is not a feature of the colors that they are ordered. Outside of some arbitrary imposed ordering, it does not make sense to say that "blue is greater than orange", or "something green has a higher/greater color than something red".
Scalar/cardinal properties have two different kinds of values: symbolic, relative values that appear on an ordered scale and numeric values. Scalar values consist of a symbolic constant and a reference class. Cardinal values consist of a cardinal number and a unit of measurement.
Properties of Entities and Events are expressed using property slots filled by instances of PropertyValue. Each property slot has a range of exactly one subclass of PropertyValue. Different property slots may have the same subclass of PropertyValue as range. For example, length, width, height, etc. all have a range of LengthValue.
(a Device with (weight ((a WeightValue)))) (a Substance with (temperature ((a TemperatureValue)))) (a PhysicalObject with (color ((a ColorValue)))) (a Event with (duration ((a DurationValue)))) 
Every property slot is filled by at most one instance of a PropertyValue. So, for example, an Entity has a single TemperatureValue, though that value may be expressed in many forms (50 degrees Fahrenheit, 10 degrees Celsius, cool for a summer day, etc.).
There are two parallel and equivalent representations for individual values of properties. The Component Library copies any values from one representation to the other. The first representation uses the value slot and KM's :pair notation. The following example shows a Device that weighs 10 pounds, 4.54 kilograms and is heavy relative to Computers. The Device has a single weight (WeightValue) but there are three representations of that weight:
(a Device with (weight ((a WeightValue with (value ((:pair 10 *pound) (:pair 4.54 *kilogram) (:pair *heavy Computer) )) ))) ) 
The value slot is also used for categorical properties, where it is filled by a simple constant (not a :pair):
(a PhysicalObject with (color ((a ColorValue with (value (*blue)) ))) ) 
The second representation for values of properties avoids KM's :pair notation. It uses three different slots in place of the generic value slot: cardinalvalue, scalarvalue and categoricalvalue. These slots are filled by one or more instances of the classes Cardinal, Scalar and Categorical. Each instance is one representation of the property value. An instance of Cardinal must have exactly one filler each for the numericvalue and unit slots. An instance of Scalar must have exactly one filler for each of the scalarconstant and referenceclass slots. An instance of Categorical must have exactly one filler for the categoricalconstant slot.
(a Device with (weight ((a WeightValue with (cardinalvalue ((a Cardinal with (numericvalue (10)) (unit (*pound)) ) (a Cardinal with (numericvalue (4.54)) (unit (*kilogram)) ) ) ) (scalarvalue ((a Scalar with (scalarconstant (*heavy)) (referenceclass (Computer)) ) ) ) ))) ) (a PhysicalObject with (color ((a ColorValue with (categoricalvalue ((a Categorical with (categoricalconstant (*blue)) ) )) ))) ) 
To summarize, here is the syntax for each representation. Constraints are enforced in KM. Values encoded in each representation are copied to the other representation so either can be used for assertions and queries.
Cardinals
Syntax
Constraints

Scalars
Syntax
Constraints

Categoricals
Syntax
Constraints

To use a Component Library property you must know the property's:
To create your own properties, you must specify the slots above (as appropriate) and create corresponding subclasses of Constant and UnitofMeasurement with appropriate instances.
Here are some examples of domain, range, categoricalconstantclass, scalarconstantclass and cardinalunitclass:
KM> (the domain of width) (SpatialEntity) KM> (the range of width) (LengthValue) KM> (the scalarconstantclass of width) (WidthConstant) KM> (the allinstances of (the scalarconstantclass of width)) (*narrow *wide) KM> (the cardinalunitclass of width) (UoMLength) KM> (the allinstances of (the cardinalunitclass of width)) (*kilometer *inch *foot *mile *yard *meter *centimeter *millimeter *micrometer *nanometer) KM> (the domain of color) (SpatialEntity) KM> (the range of color) (ColorValue) KM> (the categoricalconstantclass of color) (ColorConstant) KM> (the allinstances of (the categoricalconstantclass of color)) (*red *blue *yellow *green *orange *purple *pink *brown *black *white *gray *colorless *auburn *blond *blonde *brunette *redhead *silver *hazel *aqua *fuchsia *lime *maroon *navy *olive *teal *aliceBlue *antiqueWhite *aquamarine *azure *beige *bisque *blanchedAlmond *blueViolet *burlyWood *cadetBlue *chartreuse *chocolate *coral *cornflowerBlue *cornsilk *crimson *cyan *darkBlue *darkCyan *darkGoldenRod *darkGray *darkGreen *darkKhaki *darkMagenta *darkOliveGreen *darkorange *darkOrchid *darkRed *darkSalmon *darkSeaGreen *darkSlateBlue *darkSlateGray *darkTurquoise *darkViolet *deepPink *deepSkyBlue *dimGray *dodgerBlue *feldspar *fireBrick *floralWhite *forestGreen *gainsboro *ghostWhite *gold *goldenRod *greenYellow *honeyDew *hotPink *indianRed *indigo *ivory *khaki *lavender *lavenderBlush *lawnGreen *lemonChiffon *lightBlue *lightCoral *lightCyan *lightGoldenRodYellow *lightGrey *lightGreen *lightPink *lightSalmon *lightSeaGreen *lightSkyBlue *lightSlateBlue *lightSlateGray *lightSteelBlue *lightYellow *limeGreen *linen *magenta *mediumAquaMarine *mediumBlue *mediumOrchid *mediumPurple *mediumSeaGreen *mediumSlateBlue *mediumSpringGreen *mediumTurquoise *mediumVioletRed *midnightBlue *mintCream *mistyRose *moccasin *mavajoWhite *oldLace *oliveDrab *orangeRed *orchid *paleGoldenRod *paleGreen *paleTurquoise *paleVioletRed *papayaWhip *peachPuff *peru *plum *powderBlue *rosyBrown *royalBlue *saddleBrown *salmon *sandyBrown *seaGreen *seaShell *sienna *skyBlue *slateBlue *slateGray *snow *springGreen *steelBlue *tan *thistle *tomato *turquoise *violet *violetRed *wheat *whiteSmoke *yellowGreen) KM> (the domain of slope) (SpatialEntity) KM> (the range of slope) (UnitlessValue) KM> (the scalarconstantclass of slope) (SlopeConstant) KM> (the allinstances of (the scalarconstantclass of slope)) (*vertical *steep *gradual *horizontal) KM> (the cardinalunitclass of slope) (UoMUnitless) KM> (the allinstances of (the cardinalunitclass of slope)) (*unity) KM> (the domain of distance) (Event) KM> (the range of distance) (LengthValue) KM> (the scalarconstantclass of distance) (DistanceConstant) KM> (the allinstances of (the scalarconstantclass of distance)) (*near *far *long) KM> (the cardinalunitclass of distance) (UoMLength) 
The Component Library provides a unit converter for most Property Values and their Units of Measure. For a given instance of a subclass of PropertyValue, the CLib class UnitConversion creates a new instance of the same PropertyValue subclass with desired units. Unfortunately, the unit converter does not yet convert temperatures.
UnitConversion
Syntax
Constraints
Example

There are two kinds of expression that could rightfully claim the description "Property Value Comparison". This unfortunate fact is the source of much confusion. To be explicit, let's give neither one that label. Here we distinguish "Asserting Property Value (In)Equality" and "Testing Property Value (In)Equality".
Asserting Property Value (In)Equality is accomplished through use of the relations greaterthan (inverse lessthan) and sameas. These relations allow you to assert that one PropertyValue is greater than (or less than, or the same as) another PropertyValue. The PropertyValue instances need not have values (on the value slot). This allows the assertion of (in)equality even when the exact values are unknown.
If, however, cardinal values are given (on the value slot), assertions of (in)equality will be enforced with KM constraints:
KM> (a LengthValue) (_LengthValue5) KM> (a LengthValue) (_LengthValue6) KM> (_LengthValue5 has (greaterthan (_LengthValue6))) (_LengthValue5) KM> (the greaterthan of _LengthValue5) (_LengthValue6) KM> (the lessthan of _LengthValue6) (_LengthValue5) KM> (_LengthValue5 has (value ((:pair 2 *meter)))) (_LengthValue5) KM> (_LengthValue6 has (value ((:pair 3 *meter)))) (_LengthValue6) KM> (the greaterthan of _LengthValue5) ERROR! Constraint violation! Discarding value _LengthValue6 (Execution aborted) NIL KM> (a TemperatureValue with (value ((:pair 3 *celsius)))) (_TemperatureValue7) KM> (a TemperatureValue) (_TemperatureValue8) KM> (_TemperatureValue7 has (sameas (_TemperatureValue8))) (_TemperatureValue7) KM> (the sameas of _TemperatureValue8) (_TemperatureValue7) KM> (the value of _TemperatureValue8) NIL KM> (_TemperatureValue8 has (value ((:pair 3 *fahrenheit)))) (_TemperatureValue8) KM> (the value of _TemperatureValue8) ((:pair 3 *fahrenheit)) KM> (the sameas of _TemperatureValue7) ERROR! Constraint violation! Discarding value _TemperatureValue8 (Execution aborted) NIL 
The second kind of "Property Value Comparison" is the "Test for Property Value (In)Equality". Testing for (in)equality makes use of special infix PropertyValue operators propertyeq, propertygt, propertylt, propertygte and propertylte. The property comparison operators respect units of measure (with the sad exception of temperature for now). The operators also respect KM's default or userset mathematical tolerances:
KM> (a LengthValue with (value ((:pair 36 *inch)))) (_LengthValue11) KM> (a LenghtValue with (value ((:pair 1 *meter)))) (_LenghtValue9545) KM> (a LengthValue with (value ((:pair 1 *meter)))) (_LengthValue12) KM> (_LengthValue11 propertyeq _LengthValue12) NIL KM> (_LengthValue11 propertylt _LengthValue12) (T) KM> (_LengthValue11 propertygt _LengthValue12) NIL KM> (a VolumeValue with (value ((:pair 1 *liter)))) (_VolumeValue13) KM> (a VolumeValue with (value ((:pair 0.26417205 *gallon)))) (_VolumeValue14) KM> (_VolumeValue13 propertyeq _VolumeValue14) (T) KM> (a VolumeValue with (value ((:pair 0.264 *gallon)))) (_VolumeValue15) KM> (_VolumeValue13 propertyeq _VolumeValue15) NIL KM> (a VolumeValue with (value ((:pair 0.26417 *gallon)))) (_VolumeValue16) KM> (_VolumeValue13 propertyeq _VolumeValue16) (T) 
The Component Library also supports some arithmetic on Property Values. The following infix operators are available: propertyplus, propertyminus, propertymult and propertydiv.
Note that Property arithmetic is only as numerically accurate as the underlying Lisp arithmetic :b
Arithmetic Operators
Syntax
Constraints
Examples
