Release 16h September 2025
Change Control note Hiperspace --version 2.4.6 HiLang --version 2.4.6
Overview
This release introduces three new features for: references to views, the Any
polymorphic type and Get<TEntity>(string sid)
function for rich graph functionality with Hiperspace.DB
. Together the provide the functionality to combine any number of Hiperspaces in a combined Graph view without duplication or copying.
View References
Views in Hiperspace and generated to combine all entities, segments, aspects and views that can be projected as them, but also provide an additional role for sub-types and and complex associations.
All references in Hiperspace
are supported either by the references elements key or an index that matches the predicate used to reference it. The last release completed the optimization of view access to parts, this release adds indexing to efficiently access view items directly.
Indexed views
Consider the example of a Trading problem where Trades are booked in a Book, but each type {Fixed Income, Forex, Equity} of trade has specific properties each of different types will include an index to select Trades efficiently from Book.
view Trade (Booking : String) {Book : Book};
entity FI_Trade : Trade = Trade;
entity FX_Trade : Trade = Trade;
entity EQ_Trade : Trade = Trade;
entity Book [Trades : Trade (Book = this)];
Sub type
This UML diagram represents the logical view of the .hilang
schema above. When matched to a relational database, one of three strategies are normally followed:
- Direct: Each entity {Trade, FI_Trade, FX_Trade, EQ_Trade} is mapped separately, and joined as needed
- Down: Properties of the parent are duplicated in each of the sub-types and with context specific joining
- Up: Properties of each sub-type are added to the base type (optionally with aliases for duplicate names)
Hiperspace does not need denormalization because types can inherit from a base type, the code entity FX_Trade : Trade = Trade;
states that the entity FX_Trade inherits(:) from Trade and can be viewed(=) as a Trade
In the example above, each sub-type will be queried in parallel using the index on the Book reference
Segment / Aspect
Segments and Aspects are are owned by the entity, segment, aspect
that references them as an extension, but appear (to user programs) as a set property for segments, and value property for aspects.
entity Customer [Accounts : Has];
segment Has (Account : Account);
entity Account [HasCustomer : Has (Account = this)];
HiLang
translates the segment Has
into an element CustomerHas
(adding the key owner : Customer
), and Has
is tranformed into a view that CustomerHas
provides. If there are no other implementations of Has
(e.g. for a sub-account of Account) the view is pruned.
In this example Has
is referenced by Account
to provide a link from Account
to Customer
using the HasCustomerIndex
of the Account
. Given that the segment
/aspect
can be applied to any stored element, Has
view includes the key owner : Any
which in this case can be cast to Customer
.
Any
The new type Any
has been introduced to support segment
/aspect
views, and can be converted to any of the domain types like a union
in F#. Unlike object
, Any
can be serialized and used anywhere in the schema, when a generic reference is required. Any
is code generated by HiLang
to include a constructor for the each of the domain types, together will cast operators to convert to each of the domain types. Elements also include a cast operator to convert to an Any
when assigned.
Get(string sid)
SubSpace
provides an object? Get (string sid)
function that can be used to get an element in Hiperspace without knowing the type, just using the stringified key of the element. This function is now obsolete and has been replaced by TEntity Get<TEntity>(string sid)
that allows the desired type to be retrieved.
This methods was added for Hiperspace.DB
that includes GraphSpace
to aggregate Node
/Edge
/HiperEdge
across domains. For GraphSpace
it is necassary to call Get()
with the SKey
of a Node
and then cast to Node
which was not possible with object
because elements do not need be viewable as a Node
. GraphSpace
uses Get<Node>(skey)
for the lookup.