Attribute Expressions

Arkance Systems Benelux

Each attribute has Expression property. It's provided for situations where property value gets expressed as mathematical formula, in other words - when property value depends on some other feature property/ies, both geometric and non-geometric. Expressions can be of unlimited size and depth, i.e. one property expression may include other property whose value may also evaluate as expression, etc. Here, we say evaluate to describe Infra Suite's "solving" an expression and producing some finite value out of it. Evaluated result gets cast (converted) into the hosting type, i.e. if attribute type is Double then evaluated result gets cast into a double value.


One should always have in mind atomicity of a feature - one feature can not relate to other feature, at least not by definition (by schema). This is due to the fact that, in real-world, no one guarantees there will be two features at all. Maybe there's one, maybe two, maybe hundred... and maybe none. No one can tell in advance how many features will be there and what form of spatial and non-spatial relations they'll get into (there's another topic covering this). As for attribute expression - it can not relate to some other feature's property, it may relate only to the current feature instance.


For example, based on the following element definition:


ELEMENT NAME="e"

ATTRIBUTE NAME="a", TYPE=String

ATTRIBUTE NAME="b", TYPE=Double

ATTRIBUTE NAME="c", TYPE=Double, EXPRESSION="b + 5"


there's a feature instance with following properties:


FEATURE NAME="e"

PROPERTY NAME="a", VALUE="Some string"

PROPERTY NAME="b", VALUE=100


Once evaluated, feature will carry following property values:


FEATURE NAME="e"

PROPERTY NAME="a", VALUE="Some string"

PROPERTY NAME="b", VALUE=100

PROPERTY NAME="c", VALUE=105 <<< Value evaluated using expression formula


Mathematical Formulas


Expressions support following mathematical formulas:


Function

Description

Math.Abs()

Returns absolute value given the specified value.

Math.Acos()

Returns angle whose cosine is the specified value.

Math.Asin()

Returns angle whose sine is the specified value.

Math.Atan()

Returns angle whose tangent is the specified value.

Math.Ceiling()

Returns the largest whole number greater than or equal to specified value.

Math.Cos()

Returns the cosine of the specified angle.

Math.Cosh()

Returns the hyperbolic cosine of the specified angle.

Math.Exp()

Returns e raised to the specified power.

Math.Floor()

Returns the largest whole number less than or equal to the specified value.

if()

Provides if(condition, then, else) branching.

Math.Log()

Returns the logarithm of a specified value.

Math.Log10()

Returns the base 10 logarithm of a specified value.

Math.Max()

Returns the maximum value among provided parameters separated by comma.

Math.Min()

Returns the minimum value among provided parameters separated by comma.

Math.Round()

Returns specified value rounded to the nearest whole number.

Math.Sign()

Returns a value indicating sign of the specified value (n<0=-1, n=0=0, n>0=1).

Math.Sin()

Returns the sine of the specified angle.

Math.Sinh()

Returns the hyperbolic sine of the specified angle.

Math.Sqrt()

Returns the square root of the specified value.

Math.Tan()

Returns the tagent of the specified angle.

Math.Tanh()

Returns the hyperbolic tangent of the specified angle.

Math.Truncate()

Calculates the integral part of a specified value.


Geometric Expressions


Geometric expressions are valid only if there's feature geometry present. Expressions support following geometric keywords:


Keyword

Description

[LENGTH]

Returns geometry length. In case of point geometry returns 0, in case of polygon geometry returns total perimeter.

[AREA]

Returns geometry area. In case of point and curve geometries returns 0.

[ELEVATION]

Returns geometry elevation. In case of point geometry returns Z ordinate value, otherwise returns 0.

[ROTATION]

Returns rotation (direction vector) of point geometry. Persisting rotation geometric property depends on FDO providers.


Other Expressions


Expressions also support following keywords:


Keyword

Description

[DATETIME]

Returns string representing DateTime in UTC format.

[YEAR]

Returns integer representing a year portion of DateTime.

[USERNAME]

Returns string representing registered user name for a package (not OS).