Creating a Model

Below is the example of using the GetMs operation to create a model. The request contains an instance of opened modeling container and pattern of metadata for model creation. The response contains the created model.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetMs xmlns="http://www.fsight.ru/PP.SOM.Som">
<tMs xmlns="">
  <id>GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CEDFMNBMHGPMOFOAEEOKCHDKLPKPFFKNEILBKMMPKNGGGFEEE</id>
  </tMs>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <scenarios>Get</scenarios>
  <period>true</period>
<item>
<problem>
<metamodel>
  <calculationChain>Get</calculationChain>
  <mmParams>Get</mmParams>
  <tag>true</tag>
<calcChainPattern>
<modelPattern>
<transform>
  <inputs>Get</inputs>
  <outputs>Get</outputs>
  <formulaCount>true</formulaCount>
<formulas>
  <method />
  </formulas>
  <displayId>true</displayId>
<equationsFormula>
  <method />
  </equationsFormula>
  <series>Get</series>
  <kind>true</kind>
  <displaySettings>true</displaySettings>
  <additionalAttributes>true</additionalAttributes>
  <calculationType>true</calculationType>
  <calculationDirection>true</calculationDirection>
<transformVariable>
  <slices>Get</slices>
<transformSlice>
  <selection>Get</selection>
  </transformSlice>
  </transformVariable>
  </transform>
  <stochastic>true</stochastic>
  <calculationPeriod>true</calculationPeriod>
  <useModelPeriod>true</useModelPeriod>
  <useExistingData>true</useExistingData>
  <treatNullsAsZeros>true</treatNullsAsZeros>
  <autoName>true</autoName>
  <generatedName>true</generatedName>
  <period>true</period>
  <isExclusive>true</isExclusive>
  <useAutoPeriod>true</useAutoPeriod>
  </modelPattern>
  </calcChainPattern>
<visualControllerPattern>
  <variableRubricatorKey>true</variableRubricatorKey>
  <useSourceName>true</useSourceName>
  <levelFormat>Short</levelFormat>
  </visualControllerPattern>
  </metamodel>
  <scenarios>Get</scenarios>
  <details>true</details>
  <useSavedCoefficients>true</useSavedCoefficients>
  </problem>
  </item>
  </pattern>
<execParams>
<execCreateProblem>
  <parent>1581</parent>
  <id />
  <name>Model</name>
  </execCreateProblem>
  </execParams>
  </tArg>
  </GetMs>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetMsResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CEDFMNBMHGPMOFOAEEOKCHDKLPKPFFKNEILBKMMPKNGGGFEEE</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="key 306480" isShortcut="0" isLink="0" ver="6" hf="0">
  <i>MODELSPACE</i>
  <n>Modeling container</n>
  <k>306480</k>
  <c>5121</c>
  <p>1580</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>0</dirty>
<period>
  <start>1968-12-08</start>
  <end>2022-12-31</end>
  </period>
<scenarios>
<nodes>
<it isFolder="0">
  <k>306497</k>
  <id>OBJ306497</id>
  <n>Base</n>
  <vis>1</vis>
<scenDesc ds="" isShortcut="0" isLink="0" ver="2" hf="0">
  <i>OBJ306497</i>
  <n>Base</n>
  <k>306497</k>
  <c>5124</c>
  <p>306485</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  </scenDesc>
  <internalKey>306497</internalKey>
  </it>
  </nodes>
  </scenarios>
<item>
  <k>306669</k>
  <id>OBJ306669</id>
  <n>Model</n>
  <vis>1</vis>
  <type>Problem</type>
<problemMd>
<metamodel>
  <k>306670</k>
<calculationChain>
  <its />
  </calculationChain>
<mmParams>
  <its />
  </mmParams>
<visualController>
  <userRPath />
  <isRExist>0</isRExist>
  </visualController>
<suppressEmptyFilter>
  <suppressEmpty>0</suppressEmpty>
  <suppressEmptyArea>SerieBounds</suppressEmptyArea>
  </suppressEmptyFilter>
  <readOnly>0</readOnly>
  <variableTestUseR>0</variableTestUseR>
  <calculateIdentOnFact>0</calculateIdentOnFact>
  </metamodel>
<scenarios>
  <its />
  </scenarios>
<details>
<period>
  <identificationStartDate>1968-01-01</identificationStartDate>
  <identificationEndDate>2020-12-31</identificationEndDate>
  <forecastStartDate>2020-12-31</forecastStartDate>
  <forecastEndDate>2020-12-31</forecastEndDate>
  <identificationStartDateParamID />
  <identificationEndDateParamID />
  <forecastStartDateParamID />
  <forecastEndDateParamID />
  <autoPeriod>0</autoPeriod>
  <identificationStartOffset>0</identificationStartOffset>
  <identificationEndOffset>0</identificationEndOffset>
  <forecastEndOffset>0</forecastEndOffset>
  <isIdentStartCorrect>1</isIdentStartCorrect>
  <isIdentEndCorrect>1</isIdentEndCorrect>
  <isForecastEndCorrect>1</isForecastEndCorrect>
  </period>
  <currentPoint>2020-12-31</currentPoint>
  </details>
  <useSavedCoefficients>0</useSavedCoefficients>
  <useScenarios>0</useScenarios>
  <readOnly>0</readOnly>
  </problemMd>
  </item>
  </meta>
  </GetMsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"GetMs" :
{
"tMs" :
{
"id" : "GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CEDFMNBMHGPMOFOAEEOKCHDKLPKPFFKNEILBKMMPKNGGGFEEE"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"scenarios" : "Get",
"period" : "true",
"item" :
{
"problem" :
{
"metamodel" :
{
"calculationChain" : "Get",
"mmParams" : "Get",
"tag" : "true",
"calcChainPattern" :
{
"modelPattern" :
{
"transform" :
{
"inputs" : "Get",
"outputs" : "Get",
"formulaCount" : "true",
"formulas" :
{
"method" : ""
},
"displayId" : "true",
"equationsFormula" :
{
"method" : ""
},
"series" : "Get",
"kind" : "true",
"displaySettings" : "true",
"additionalAttributes" : "true",
"calculationType" : "true",
"calculationDirection" : "true",
"transformVariable" :
{
"slices" : "Get",
"transformSlice" :
{
"selection" : "Get"
}
}
},
"stochastic" : "true",
"calculationPeriod" : "true",
"useModelPeriod" : "true",
"useExistingData" : "true",
"treatNullsAsZeros" : "true",
"autoName" : "true",
"generatedName" : "true",
"period" : "true",
"isExclusive" : "true",
"useAutoPeriod" : "true"
}
},
"visualControllerPattern" :
{
"variableRubricatorKey" : "true",
"useSourceName" : "true",
"levelFormat" : "Short"
}
},
"scenarios" : "Get",
"details" : "true",
"useSavedCoefficients" : "true"
}
}
},
"execParams" :
{
"execCreateProblem" :
{
"parent" : "1581",
"id" : "",
"name" : "Model"
}
}
}
}
}

JSON response:

{
"GetMsResult" :
{
"id" :
{
"id" : "GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CEDFMNBMHGPMOFOAEEOKCHDKLPKPFFKNEILBKMMPKNGGGFEEE"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "key 306480",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "6",
"@hf" : "0",
"i" : "MODELSPACE",
"n" : "Modeling container",
"k" : "306480",
"c" : "5121",
"p" : "1580",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"period" :
{
"start" : "1968-12-08",
"end" : "2022-12-31"
},
"scenarios" :
{
"nodes" :
{
"it" :
{
"@isFolder" : "0",
"k" : "306497",
"id" : "OBJ306497",
"n" : "Basic",
"vis" : "1",
"scenDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "2",
"@hf" : "0",
"i" : "OBJ306497",
"n" : "Basic",
"k" : "306497",
"c" : "5124",
"p" : "306485",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0"
},
"internalKey" : "306497"
}
}
},
"item" :
{
"k" : "306669",
"id" : "OBJ306669",
"n" : "Model",
"vis" : "1",
"type" : "Problem",
"problemMd" :
{
"metamodel" :
{
"k" : "306670",
"calculationChain" :
{
"its" : ""
},
"mmParams" :
{
"its" : ""
},
"visualController" :
{
"userRPath" : "",
"isRExist" : "0"
},
"suppressEmptyFilter" :
{
"suppressEmpty" : "0",
"suppressEmptyArea" : "SerieBounds"
},
"readOnly" : "0",
"variableTestUseR" : "0",
"calculateIdentOnFact" : "0"
},
"scenarios" :
{
"its" : ""
},
"details" :
{
"period" :
{
"identificationStartDate" : "1968-01-01",
"identificationEndDate" : "2020-12-31",
"forecastStartDate" : "2020-12-31",
"forecastEndDate" : "2020-12-31",
"identificationStartDateParamID" : "",
"identificationEndDateParamID" : "",
"forecastStartDateParamID" : "",
"forecastEndDateParamID" : "",
"autoPeriod" : "0",
"identificationStartOffset" : "0",
"identificationEndOffset" : "0",
"forecastEndOffset" : "0",
"isIdentStartCorrect" : "1",
"isIdentEndCorrect" : "1",
"isForecastEndCorrect" : "1"
},
"currentPoint" : "2020-12-31"
},
"useSavedCoefficients" : "0",
"useScenarios" : "0",
"readOnly" : "0"
}
}
}
}
}
public static string GetMsNewModel(MsId ms, uint msKey, string id, string modelName)
{
// Create a proxy object for operation execution
var somClient = new SomPortTypeClient();
// Operation execution parameters
var getMsOp = new GetMs()
{
tArg = new GetMsArg()
{
// Metadata extraction pattern
pattern = new MsMdPattern()
{
scenarios = ListOperation.Get,
period = true,
item = new MsItemPattern()
{ // Model metadata pattern
problem = new MsProblemPattern()
{
details = true,
scenarios = ListOperation.Get,
useSavedCoefficients = true,
// Metamodel metadata pattern
metamodel = new MsMetaModelPattern()
{
calculationChain = ListOperation.Get,
mmParams = ListOperation.Get,
tag = true,
// Metadata pattern for calculation chain
calcChainPattern = new MsCalculationChainPattern()
{
modelPattern = new MsModelPattern()
{
transform = new MsFormulaTransformPattern()
{
inputs = ListOperation.Get,
outputs = ListOperation.Get,
kind = true,
formulaCount = true,
formulas = new TsFormulaPattern()
{
method = new TsMethodPattern()
},
displayId = true,
equationsFormula = new TsFormulaPattern()
{
method = new TsMethodPattern()
},
series = ListOperation.Get,
displaySettings = true,
additionalAttributes = true,
calculationType = true,
calculationDirection = true,
transformVariable = new MsFormulaTransformVariablePattern()
{
slices = ListOperation.Get,
transformSlice = new MsFormulaTransformSlicePattern()
{
selection = ListOperation.Get
}
}
},
stochastic = true,
calculationPeriod = true,
useModelPeriod = true,
useExistingData = true,
treatNullsAsZeros = true,
autoName = true,
period = true,
isExclusive = true,
useAutoPeriod = true,
generatedName = true
}
},
visualControllerPattern = new MsMetaModelVisualControllerPattern()
{
variableRubricatorKey = true,
levelFormat = MsLevelFormat.Short,
useSourceName = true
}
}
}
}
},
execParams = new MsMdExecParams()
{
execCreateProblem = new MsMdExecCreateProblem()
{
id = id,
name = modelName,
key = null,
parent = msKey
}
}
},
tMs = ms
};
// Create a model
var result = somClient.GetMs(getMsOp);
return result.meta.item.id;
}

See also:

GetMs: Operation