company logo

Path properties

In contrast to property paths, path properties allow navigating through a defined property hierarchy. Syntactically, a property path differs from a path property by containing at least one navigation element ([]- or ()-operator).

The ()-operator is the selector operator, which indicates either an iteration element or an instance selection. The []-operator is the provide operator, which selects or creates an instance when not yet existing.

Depending on the selector and provide operators, a path property refers to a collection of instances of the type being defined in the last path element, i.e. a path property can be seen as the collection of all instances one receives when iterating through the property hierarchy, which is a sort of specific union operation.

In general, you can express each path property by a sequence of property references and appropriate function calls for instance selection and iteration. But the path property is a better way in many cases, since it prevents you from programming errors, is easier to write and more transparent for other readers. Path properties are typically used in OSI expressions. Using path properties in application programs is more a matter of taste.

// access to city via path proprty

void test(ObjectSpace &obh)

  Property     cities(obh, "Person::Persons().address(0).city", PI_Read);

  while ( cities.next() )

    SystemClass::message(cities);

}

// osi example

void main()

{

VARIABLES

  set<STRING>    &cities = Person::Persons().address(0).city;

  while ( cities.next );            // property path

    message(cities);        

}

Notes:

We tend to use path property handles rather than basic property handles for two reasons. One is, that we need less to write, the other that programs become more transparent, since you can easily recognize the property hierarchy defined in a path.