1 | |
---|
2 | #Require MMS; |
---|
3 | |
---|
4 | ////////////////////////////////////////////////////////////////////////////// |
---|
5 | // Queremos copiar detemrinados términos explicativos del submodelo |
---|
6 | // de una estimación al submodelo de otra |
---|
7 | |
---|
8 | MMS::@Estimation estOri = ...; |
---|
9 | MMS::@Estimation estDes = ...; |
---|
10 | |
---|
11 | MMS::@Submodel submodelOri = estOri::GetModel(?)::GetSubmodel(1); |
---|
12 | MMS::@Submodel submodelDes = estDes::GetModel(?)::GetSubmodel(1); |
---|
13 | |
---|
14 | // Se seleccionan los términos explicativos que desean copiarse |
---|
15 | |
---|
16 | Set expTermsOri = submodelOri::GetExpTerms(?); |
---|
17 | |
---|
18 | Set expTermsOri_Sel = Select(expTermsOri, Real (MMS::@ExpTerm expTerm) { |
---|
19 | Text metric = expTerm::GetInput(?)::GetVariable(?) |
---|
20 | ::GetAttribute_Default("_.metrica", ""); |
---|
21 | metric=="Pro_DamySem" |
---|
22 | }); |
---|
23 | |
---|
24 | // Se comprueba que no existen en destino: |
---|
25 | /* |
---|
26 | Set expTermsDes = submodelDes::GetExpTerms(?); |
---|
27 | |
---|
28 | Set expTermIntersection = |
---|
29 | MMS::Intersection_Eq(expTermsOri_Sel, expTermsDes, MMS::SameName); |
---|
30 | |
---|
31 | Real If(Card(expTermIntersection)>0, { |
---|
32 | WriteLn("Hay "<<Card(expTermIntersection) |
---|
33 | <<" términos que ya están en destino.", "E"); |
---|
34 | Real Stop |
---|
35 | }); |
---|
36 | */ |
---|
37 | |
---|
38 | // Se extraen las variables relacionadas y sus dependencias: |
---|
39 | |
---|
40 | Set variablesOri_Sel = MMS::Unique_Eq(SetConcat( |
---|
41 | EvalSet(expTermsOri_Sel, Set (MMS::@ExpTerm expTerm) { |
---|
42 | MMS::@Variable variable = expTerm::GetInput(?)::GetVariable(?); |
---|
43 | [[ PutName(variable::GetIdentifier(?), variable) ]] |
---|
44 | << variable::GetDependences_ToLevel(?) |
---|
45 | }) |
---|
46 | ), SameNameBlock); |
---|
47 | |
---|
48 | // Se comprueba que no existen en destino: |
---|
49 | |
---|
50 | MMS::@DataSet dataSetDes = estDes::GetModel(?)::GetDataSet(?); |
---|
51 | /* |
---|
52 | Set variablesDes = dataSetDes::GetVariables(?); |
---|
53 | |
---|
54 | Set variableIntersection = |
---|
55 | MMS::Intersection_Eq(variablesOri_Sel, variablesDes, MMS::SameName); |
---|
56 | |
---|
57 | Real If(Card(variableIntersection)>0, { |
---|
58 | WriteLn("Hay "<<Card(variableIntersection) |
---|
59 | <<" variables que ya están en destino.", "E"); |
---|
60 | Real Stop |
---|
61 | }); |
---|
62 | */ |
---|
63 | |
---|
64 | // Se insertan las variables en destino: |
---|
65 | |
---|
66 | Set EvalSet(variablesOri_Sel, Anything (MMS::@Variable varOri) { |
---|
67 | dataSetDes::CreateVariable_Spc(varOri::GetSpecification(?)) |
---|
68 | }); |
---|
69 | |
---|
70 | // Se insertan los términos (junto a las m-variables) en destino: |
---|
71 | |
---|
72 | MMS::@Model modelDes = estDes::GetModel(?); |
---|
73 | |
---|
74 | Set EvalSet(expTermsOri_Sel, Anything (MMS::@ExpTerm etOri) { |
---|
75 | Anything modelDes::CreateMVariable_Spc(etOri::GetInput(?) |
---|
76 | ::GetSpecification(?)); |
---|
77 | submodelDes::CreateExpTerm_Spc(etOri::GetSpecification(?)) |
---|
78 | }); |
---|
79 | |
---|
80 | ////////////////////////////////////////////////////////////////////////////// |
---|