HasVariableRubricator: Boolean;
HasVariableRubricator: boolean;
The HasVariableRubricator property determines whether a metamodel has the internal time series database.
Available values:
True. The metamodel contains internal time series database.
False. The metamodel does not contain internal time series database.
On setting HasVariableRubricator to True, the internal time series database and the dictionary used to store internal variables names are created automatically. If the False value is set, and there are no models, built on the internal time series database, the dictionary and the database are deleted, otherwise the exception is thrown.
Executing the example requires:
Time series database with the TSDB identifier containing a time series with the 12 key
A modeling container with THE MS identifier, containing a metamodel with the META identifier.
Add links to the Dimensions, Metabase, Ms system assemblies.
Sub HasVariableRubricator;
Var
mb: IMetabase;
RubObj: IMetabaseObjectDescriptor;
Meta: IMsMetaModel;
MetaVisual: IMsMetaModelVisualController;
VarInp, VarOutp: IMsCalculationChainVariable;
VarEx: Boolean;
InVarKey, InModelKey: Integer;
InpKeys: Array[1] Of Integer;
SimpleModel: IMsModel;
Begin
mb := MetabaseClass.Active;
// Get time series database
RubObj := mb.ItemById("TSDB");
// Get metamodel
Meta := mb.ItemByIdNamespace("META", mb.ItemById("MS").Key).Edit As IMsMetaModel;
MetaVisual := Meta.VisualController;
// If necessary, then create the internal time series database for the metamodel
If Not MetaVisual.HasVariableRubricator Then
MetaVisual.HasVariableRubricator := True;
End If;
// Get the key of the input variable
VarInp := MetaVisual.GetVariableByFactor(RubObj.Key, 12, "", VarEx);
InpKeys[0] := VarInp.Key;
// Create output variable
VarOutp := MetaVisual.CreateVariable("Internal output variable", "", DimCalendarLevel.Year, VarEx);
// Create the internal model
SimpleModel := MetaVisual.CreateSimpleModel(-1, InpKeys, VarOutp.Key, MsFormulaKind.LinearRegression, "", InVarKey, InModelKey, -1, -1, True);
// Add the internal variable as the factor to the model
MetaVisual.AddFactor(SimpleModel, VarOutp.Key, "", InVarKey, InModelKey, -1);
// Display model name in the console window
Debug.WriteLine(SimpleModel.CreateStringGenerator.Execute);
// Save metamodel
(Meta As IMetabaseObject).Save;
End Sub HasVariableRubricator;
Example execution result: the internal model of linear regression containing two factors will be created in the META metamodel. Model is calculated by R. Name of the model is displayed in the console window.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
RubObj: IMetabaseObjectDescriptor;
Meta: IMsMetaModel;
MetaVisual: IMsMetaModelVisualController;
VarInp, VarOutp: IMsCalculationChainVariable;
VarEx: Boolean;
InVarKey, InModelKey: Integer;
InpKeys: Array[1] Of integer;
SimpleModel: IMsModel;
Begin
mb := Params.Metabase;
// Get time series database
RubObj := mb.ItemById["TSDB"];
// Get metamodel
Meta := mb.ItemByIdNamespace["META", mb.ItemById["MS"].Key].Edit() As IMsMetaModel;
MetaVisual := Meta.VisualController;
// If necessary, then create the internal time series database for the metamodel
If Not MetaVisual.HasVariableRubricator Then
MetaVisual.HasVariableRubricator := True;
End If;
// Get the key of the input variable
VarInp := MetaVisual.GetVariableByFactor(RubObj.Key, 12, "", Var VarEx, uinteger.MaxValue);
InpKeys[0] := VarInp.Key As integer;
// Create output variable
VarOutp := MetaVisual.CreateVariable("Internal output variable", "", DimCalendarLevel.dclYear, Var VarEx,
uinteger.MaxValue, False);
// Create internal model
SimpleModel := MetaVisual.CreateSimpleModel(-1, InpKeys, VarOutp.Key As integer, MsFormulaKind.mfkLinearRegression,
"", Var InVarKey, Var InModelKey, uinteger.MaxValue, uinteger.MaxValue, True);
// Add the internal variable as the factor to the model
MetaVisual.AddFactor(SimpleModel, VarOutp.Key As integer, "", Var InVarKey, Var InModelKey, uinteger.MaxValue, uinteger.MaxValue);
// Display model name in the console window
System.Diagnostics.Debug.WriteLine(SimpleModel.CreateStringGenerator().Execute());
// Save metamodel
(Meta As IMetabaseObject).Save();
End Sub;
See also: