EditMetaModel: IMsMetaModel;
EditMetaModel: Prognoz.Platform.Interop.Ms.IMsMetaModel;
The EditMetaModel property returns internal model.
To create an internal metamodel, use the IMsProblem.CreateMetaModel method.
Executing the example requires that the repository contains a modeling container with the MS identifier that contains a modeling problem with the PROBLEM_META identifier and a model with the MODEL_LINEARREGR identifier. The modeling problem must contain the internal metamodel.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsKey: Integer;
CreateInfo: IMetabaseObjectCreateInfo;
Problem: IMsProblem;
Model: IMsModel;
MetaModel: IMsMetaModel;
CalcChain: IMsCalculationChainEntries;
Begin
// Get repository
Mb := MetabaseClass.Active;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get modeling problem
Problem := Mb.ItemByIdNamespace("PROBLEM_META", MsKey).Edit As IMsProblem;
// Get internal metamodel
MetaModel := Problem.EditMetaModel;
// Get metamodel calculation chain
CalcChain := MetaModel.CalculationChain;
// Get model
Model := mb.ItemByIdNamespace("MODEL_LINEARREGR", MsKey).Edit As IMsModel;
If CalcChain.FindById("MODEL_LINEARREGR") = Null Then
// Add obtained model to calculation chain
CalcChain.AddModel(Model);
End If;
// Save changes
(Problem As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the specified model is added to the problem calculation chain.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
MsKey: uinteger;
CreateInfo: IMetabaseObjectCreateInfo;
Problem: IMsProblem;
Model: IMsModel;
MetaModel: IMsMetaModel;
CalcChain: IMsCalculationChainEntries;
Begin
// Get repository
Mb := Params.Metabase;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get modeling problem
Problem := Mb.ItemByIdNamespace["PROBLEM_META", MsKey].Edit() As IMsProblem;
// Get internal metamodel
MetaModel := Problem.EditMetaModel;
// Get metamodel calculation chain
CalcChain := MetaModel.CalculationChain;
// Get model
Model := mb.ItemByIdNamespace["MODEL_LINEARREGR", MsKey].Edit() As IMsModel;
If CalcChain.FindById("MODEL_LINEARREGR") = Null Then
// Add obtained model to calculation chain
CalcChain.AddModel(Model);
End If;
// Save changes
(Problem As IMetabaseObject).Save();
End Sub;
See also: