Aspect


HiLang Aspect is a variation of Segment, for cases where there is a single value rather than a collection. From Application, using an aspect is the same as using value - they both appear as a property of the domain object, but the storage is different.

HiLang Aspects must not have keys as they are identified by their owner, and owner is added during code generation.

Aspects can be versioned independently of the element that contains them, and since they are stored in Hiperspace, they can provide `Node' and 'Edge' views.

In this example, Plan.Tasks.Actual could have been modelled as either a Value by changing the type and moving the reference to the value section. The value section cannot have aspects or segments, while the extent section can not have values.

value Plan.Duration
{
    Start    : DateTime,
    End      : DateTime,
    Valid    = Start <= End ? true : false
}
[
    Time     = hours (End , Start)
];
@Versioned
aspect Plan.Tasks.Actual
{
    Duration    : Plan.Duration,
    Close       : DateTime,
    "set of the controllers that have approved this update"
    Approval    : Set<String>,
    Cost        : Decimal
};
entity Plan.Tasks.Task : Versioned
(
    Project     : Plan.Project,
    Id          : Int32
)
{
    Duration    : Plan.Duration,
}
[
    Actual      : Plan.Tasks.Actual,
]

Usage

Aspects become very useful when they change much more often than the entity/segment/aspect that references them. Fro a large financial contract like an FpML where a reference price changes often during drafting, only the Price aspect needs to update.

Copyright © Cepheis 2024