EditMetaModel: 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 and 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.
See also: