Sortal Description Language   Index

 

Individuals

An individual is an element of a sort, e.g., a point is an individual of the sort of points. The characteristic individual of a sort specifies the representation of each individual. The naming of sorts allows for a classification of individuals by meaning, defined by the user.

An individual is completely specified by its sort and its representational value.

  • The specification of the sort is optional only if it can be derived from the context, that is, when an individual is specified within a form.
  • The expressive structure of the representational value is entirely specified by the characteristic individual.

The specification of an individual may also include a reference key.

  • A reference key is a unique identifier that, when assigned to an individual, can be used elsewhere to reference this particular individual.

All elements within the specification can be freely separated with whitespaces (spaces, tabs and new lines). This also applies to all marks that are used to identify and enclose, or separate, representational values and expressions, such as parentheses, angular brackets, and commas. Double quotation marks form an exception to this: any spaces between double quotation marks will not be ignored and must form part of the specification.

individual		    ind-specification
			    sort-name : ind-specification
			    # reference-key ind-specification
			    sort-name : # reference-key ind-specification

ind-specification	    nil
			    integer
			    number
			    identifier
			    "string"
			    date
			    < date , date >
			    "url"
			    ( "url" , "url" )
			    reference-key
			    ( reference-key , reference-key )
			    color-specification
			    key-specification
			    geometric-specification
			    functional-specification

date			    "string"
			    integer

reference-key		    context-name - sort-name - integer

context-name		    identifier

color-specification	    [ number , number , number ]
			    [ number , number , number , number ]

key-specification	    "identifier"
			    "identifier-integer"
			    "identifier-identifier"
			    "identifier-identifier-integer"

geometric-specification	    position
			    < position , position >
			    < position , position , position >
			    < position , position > < position , position >
			    < position , position , position > < position , position >
			    < boundaries >

position		    ( integer, integer, integer )
			    integer ( integer, integer, integer )
			    integer / integer ( integer, integer, integer )

boundaries		    boundary
			    boundary , boundaries

boundary		    < position , position , positions >

positions		    position
			    position , positions

functional-specification    function ( function-arguments )
			    function ( function-arguments ) = value

function		    main-function
			    main-function | aux-function

main-function		    function-name

aux-function		    function-name

function-name		    identifier

function-arguments	    function-argument
			    function-argument , function-arguments

function-argument	    sort-name . method-name

method-name		    identifier

value			    number
			    ( number , number , number )

The terms identifier, integer, number (floating-point number), string and url follow the normal conventions.
The term sort-name is defined in the Sorts section.

Position vectors are commonly used as a representational element in the representation of geometric individuals. A position vector is always three-dimensional and rational, and is expressed as a parenthesized triple of integer coordinates optionally preceded by a rational multiplication factor.

Each characteristic individual specifies the exact format of its representational expression.

  • Label : A label is represented as a string enclosed in double quotation marks. An empty string denotes nil.
  • Numeric, Weight and Sign : A numeric label, weight, or sign is represented as a number.
    In the case of a weight, this number must be positive and less than the optional upper bound specified by the argument to the sort. In both the case of a weight and a sign, a zero value denotes nil.
  • Point : A point is represented as a position vector (i.e., a parenthesized triple of integer coordinates optionally preceded by a rational multiplication factor).
  • Line and LineSegment : A line or line segment is represented as a pair of position vectors enclosed within angular brackets (<>); these must not coincide.
    In the case of a line segment, these position vectors define its endpoints.
  • Plane : A plane is represented as a normal vector preceded by a rational scalar. The normal vector may not be zero. Then, the scalar specifies the position of the root of the plane wrt to the normal vector.
  • PlaneSegment : A plane segment is represented as a tuple of boundaries enclosed within angular brackets (<>). The first boundary is the outer boundary of the plane segment, any other boundaries must be inner boundaries (defining holes in the plane segment). Each boundary is described as a tuple of position vectors defining the consecutive vertices of the boundary.
  • Circle : A circle is represented as a triple of position vectors enclosed within angular brackets (<>). These position vectors define the respective center of the circle, a (pin) point on the circle and a third point on the plane. These positions must be non-colinear.
  • Ellipse : An ellipse is also represented as a triple of position vectors enclosed within angular brackets (<>). These position vectors define the respective foci of the ellipse and a (pin) point on the ellipse, not colinear with the foci.
  • Arc and CircularArc : An (circular) arc is represented as two tuples of position vectors, each enclosed within angular brackets (<>). The first triple of position vectors describes the ellipse (focus1, focus2, pin) or circle (center, pin and third point) the arc is embedded in (see above). The second pair of position vectors defines the respective start and endpoints of the arc. In the case of a circular arc, if the center, pin, starting and ending positions are not all colinear, then the third point on the plane can be omitted.
  • Date : A date is represented as an integer number or as a quoted string representing a date.
  • TimePeriod : A pair of dates enclosed within angular brackets (<>). Each date is represented as an integer number or as a quoted string representing a date.
  • Color : A color is represented as a tuple of three or four positive numbers enclosed within square brackets ([]). Depending on the color model specified for the sort (RGB or HSV), the first three numbers specify the corresponding color values. The optional fourth number specifies an alpha value, in case the behavior for the sort is dependent on the specification of alpha values. The default alpha value is 0.
  • Enumerative : An enumerative is represented as an identifier. This identifier must specify one of the enumerative values as defined for the sort.
  • Key : A key is minimally represented as a base identifier. If an argument is specified to the sort, this argument precedes the base identifier, separated by a hyphen (-). The base identifier may also be followed by an integer number, again separated by a hyphen. The entire key string is enclosed in double quotation marks.
  • Url and ImageUrl : A URL is represented as a URL address string enclosed in double quotation marks.
    An image URL is represented as a pair of quoted URL address strings, the first of which is meant to specify the image, the second an iconic version of this image.
  • Property : A propery is represented as a parenthesized pair of references to the related individuals. When a property is specified within a form, that is, an attribute form to one of the related individuals, the associate individual to the form may be omitted together with the parentheses.
  • Function : A function is minimally represented by a main function name and a parenthesized tuple of function arguments. The main function name may also be followed by an auxilliary function name, separated by a vertical bar (|). Each function argument is composed of a primitive sort name and a method name of this sort's characteristic individual concatenated with a dot (.). This method cannot take any arguments and must return either a number or a vector of three numbers. A value specification, that is an equal sign (=) followed by a single number or a parenthesized tuple of three numbers, may complete the functional expression.
    More on the definition of functions

Each characteristic individual also specifies a null individual, named nil. It has no intrinsic value, but may result from taking the complement of an individual with respect to another individual, or determining the common part of two individuals, when there is no complement or common part.

 

Examples

points : (0,0,0)	    // A point with coordinates 0,0,0

points : #my-points-1 (0,0,0)
			    // A point with reference key 'my-points-1'

lines : <(0,0,0), 3/4(2,3,0)>
			    // A line segment with endpoints (0,0,0) and (1.5,2.25,0)

functions : sum(lines.length)

labels : #my-labels-1 "origin"
			    // A label with reference key 'my-labels-1'

weights : 0.5		    // A weight of value 0.5

has_labels : (my-points-1, my-labels-1)
			    // A property of the sort 'has-labels' that relates
			    // the  individuals with reference keys 'my-points-1'
			    // and 'my-labels-1'

Two forward slashes (//) denote a comment, everything from the slashes until the end of the line is ignored.
The definition of these sorts is exemplified in the Sorts section.

 
 
 

Last update: 5 July 2012, webmaster @ sortal.org