diff options
24 files changed, 1734 insertions, 398 deletions
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/AggregateExpression.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/AggregateExpression.java index be146469..589145c3 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/AggregateExpression.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/AggregateExpression.java | |||
@@ -2,6 +2,8 @@ | |||
2 | */ | 2 | */ |
3 | package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage; | 3 | package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage; |
4 | 4 | ||
5 | import org.eclipse.emf.common.util.EList; | ||
6 | |||
5 | 7 | ||
6 | /** | 8 | /** |
7 | * <!-- begin-user-doc --> | 9 | * <!-- begin-user-doc --> |
@@ -13,6 +15,8 @@ package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage; | |||
13 | * </p> | 15 | * </p> |
14 | * <ul> | 16 | * <ul> |
15 | * <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression#getRelation <em>Relation</em>}</li> | 17 | * <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression#getRelation <em>Relation</em>}</li> |
18 | * <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression#getParameterSubstitution <em>Parameter Substitution</em>}</li> | ||
19 | * <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression#getResultVariable <em>Result Variable</em>}</li> | ||
16 | * </ul> | 20 | * </ul> |
17 | * | 21 | * |
18 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage#getAggregateExpression() | 22 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage#getAggregateExpression() |
@@ -46,4 +50,38 @@ public interface AggregateExpression extends Term { | |||
46 | */ | 50 | */ |
47 | void setRelation(Relation value); | 51 | void setRelation(Relation value); |
48 | 52 | ||
53 | /** | ||
54 | * Returns the value of the '<em><b>Parameter Substitution</b></em>' containment reference list. | ||
55 | * The list contents are of type {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution}. | ||
56 | * <!-- begin-user-doc --> | ||
57 | * <!-- end-user-doc --> | ||
58 | * @return the value of the '<em>Parameter Substitution</em>' containment reference list. | ||
59 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage#getAggregateExpression_ParameterSubstitution() | ||
60 | * @model containment="true" | ||
61 | * @generated | ||
62 | */ | ||
63 | EList<AggregatedParameterSubstitution> getParameterSubstitution(); | ||
64 | |||
65 | /** | ||
66 | * Returns the value of the '<em><b>Result Variable</b></em>' reference. | ||
67 | * <!-- begin-user-doc --> | ||
68 | * <!-- end-user-doc --> | ||
69 | * @return the value of the '<em>Result Variable</em>' reference. | ||
70 | * @see #setResultVariable(Variable) | ||
71 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage#getAggregateExpression_ResultVariable() | ||
72 | * @model | ||
73 | * @generated | ||
74 | */ | ||
75 | Variable getResultVariable(); | ||
76 | |||
77 | /** | ||
78 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression#getResultVariable <em>Result Variable</em>}' reference. | ||
79 | * <!-- begin-user-doc --> | ||
80 | * <!-- end-user-doc --> | ||
81 | * @param value the new value of the '<em>Result Variable</em>' reference. | ||
82 | * @see #getResultVariable() | ||
83 | * @generated | ||
84 | */ | ||
85 | void setResultVariable(Variable value); | ||
86 | |||
49 | } // AggregateExpression | 87 | } // AggregateExpression |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/AggregatedParameterSubstitution.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/AggregatedParameterSubstitution.java new file mode 100644 index 00000000..94b6365d --- /dev/null +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/AggregatedParameterSubstitution.java | |||
@@ -0,0 +1,46 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage; | ||
4 | |||
5 | import org.eclipse.emf.ecore.EObject; | ||
6 | |||
7 | /** | ||
8 | * <!-- begin-user-doc --> | ||
9 | * A representation of the model object '<em><b>Aggregated Parameter Substitution</b></em>'. | ||
10 | * <!-- end-user-doc --> | ||
11 | * | ||
12 | * <p> | ||
13 | * The following features are supported: | ||
14 | * </p> | ||
15 | * <ul> | ||
16 | * <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution#getVariable <em>Variable</em>}</li> | ||
17 | * </ul> | ||
18 | * | ||
19 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage#getAggregatedParameterSubstitution() | ||
20 | * @model | ||
21 | * @generated | ||
22 | */ | ||
23 | public interface AggregatedParameterSubstitution extends EObject { | ||
24 | /** | ||
25 | * Returns the value of the '<em><b>Variable</b></em>' reference. | ||
26 | * <!-- begin-user-doc --> | ||
27 | * <!-- end-user-doc --> | ||
28 | * @return the value of the '<em>Variable</em>' reference. | ||
29 | * @see #setVariable(Variable) | ||
30 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage#getAggregatedParameterSubstitution_Variable() | ||
31 | * @model | ||
32 | * @generated | ||
33 | */ | ||
34 | Variable getVariable(); | ||
35 | |||
36 | /** | ||
37 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution#getVariable <em>Variable</em>}' reference. | ||
38 | * <!-- begin-user-doc --> | ||
39 | * <!-- end-user-doc --> | ||
40 | * @param value the new value of the '<em>Variable</em>' reference. | ||
41 | * @see #getVariable() | ||
42 | * @generated | ||
43 | */ | ||
44 | void setVariable(Variable value); | ||
45 | |||
46 | } // AggregatedParameterSubstitution | ||
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/LogiclanguageFactory.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/LogiclanguageFactory.java index a6b0a790..33d79329 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/LogiclanguageFactory.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/LogiclanguageFactory.java | |||
@@ -454,6 +454,15 @@ public interface LogiclanguageFactory extends EFactory { | |||
454 | Max createMax(); | 454 | Max createMax(); |
455 | 455 | ||
456 | /** | 456 | /** |
457 | * Returns a new object of class '<em>Aggregated Parameter Substitution</em>'. | ||
458 | * <!-- begin-user-doc --> | ||
459 | * <!-- end-user-doc --> | ||
460 | * @return a new object of class '<em>Aggregated Parameter Substitution</em>'. | ||
461 | * @generated | ||
462 | */ | ||
463 | AggregatedParameterSubstitution createAggregatedParameterSubstitution(); | ||
464 | |||
465 | /** | ||
457 | * Returns the package supported by this factory. | 466 | * Returns the package supported by this factory. |
458 | * <!-- begin-user-doc --> | 467 | * <!-- begin-user-doc --> |
459 | * <!-- end-user-doc --> | 468 | * <!-- end-user-doc --> |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/LogiclanguagePackage.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/LogiclanguagePackage.java index ddfb75a2..193d9bdd 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/LogiclanguagePackage.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/LogiclanguagePackage.java | |||
@@ -2751,13 +2751,31 @@ public interface LogiclanguagePackage extends EPackage { | |||
2751 | int AGGREGATE_EXPRESSION__RELATION = TERM_FEATURE_COUNT + 0; | 2751 | int AGGREGATE_EXPRESSION__RELATION = TERM_FEATURE_COUNT + 0; |
2752 | 2752 | ||
2753 | /** | 2753 | /** |
2754 | * The feature id for the '<em><b>Parameter Substitution</b></em>' containment reference list. | ||
2755 | * <!-- begin-user-doc --> | ||
2756 | * <!-- end-user-doc --> | ||
2757 | * @generated | ||
2758 | * @ordered | ||
2759 | */ | ||
2760 | int AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION = TERM_FEATURE_COUNT + 1; | ||
2761 | |||
2762 | /** | ||
2763 | * The feature id for the '<em><b>Result Variable</b></em>' reference. | ||
2764 | * <!-- begin-user-doc --> | ||
2765 | * <!-- end-user-doc --> | ||
2766 | * @generated | ||
2767 | * @ordered | ||
2768 | */ | ||
2769 | int AGGREGATE_EXPRESSION__RESULT_VARIABLE = TERM_FEATURE_COUNT + 2; | ||
2770 | |||
2771 | /** | ||
2754 | * The number of structural features of the '<em>Aggregate Expression</em>' class. | 2772 | * The number of structural features of the '<em>Aggregate Expression</em>' class. |
2755 | * <!-- begin-user-doc --> | 2773 | * <!-- begin-user-doc --> |
2756 | * <!-- end-user-doc --> | 2774 | * <!-- end-user-doc --> |
2757 | * @generated | 2775 | * @generated |
2758 | * @ordered | 2776 | * @ordered |
2759 | */ | 2777 | */ |
2760 | int AGGREGATE_EXPRESSION_FEATURE_COUNT = TERM_FEATURE_COUNT + 1; | 2778 | int AGGREGATE_EXPRESSION_FEATURE_COUNT = TERM_FEATURE_COUNT + 3; |
2761 | 2779 | ||
2762 | /** | 2780 | /** |
2763 | * The number of operations of the '<em>Aggregate Expression</em>' class. | 2781 | * The number of operations of the '<em>Aggregate Expression</em>' class. |
@@ -2788,6 +2806,24 @@ public interface LogiclanguagePackage extends EPackage { | |||
2788 | int PROJECTED_AGGREGATE_EXPRESSION__RELATION = AGGREGATE_EXPRESSION__RELATION; | 2806 | int PROJECTED_AGGREGATE_EXPRESSION__RELATION = AGGREGATE_EXPRESSION__RELATION; |
2789 | 2807 | ||
2790 | /** | 2808 | /** |
2809 | * The feature id for the '<em><b>Parameter Substitution</b></em>' containment reference list. | ||
2810 | * <!-- begin-user-doc --> | ||
2811 | * <!-- end-user-doc --> | ||
2812 | * @generated | ||
2813 | * @ordered | ||
2814 | */ | ||
2815 | int PROJECTED_AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION = AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION; | ||
2816 | |||
2817 | /** | ||
2818 | * The feature id for the '<em><b>Result Variable</b></em>' reference. | ||
2819 | * <!-- begin-user-doc --> | ||
2820 | * <!-- end-user-doc --> | ||
2821 | * @generated | ||
2822 | * @ordered | ||
2823 | */ | ||
2824 | int PROJECTED_AGGREGATE_EXPRESSION__RESULT_VARIABLE = AGGREGATE_EXPRESSION__RESULT_VARIABLE; | ||
2825 | |||
2826 | /** | ||
2791 | * The feature id for the '<em><b>Projection Index</b></em>' attribute. | 2827 | * The feature id for the '<em><b>Projection Index</b></em>' attribute. |
2792 | * <!-- begin-user-doc --> | 2828 | * <!-- begin-user-doc --> |
2793 | * <!-- end-user-doc --> | 2829 | * <!-- end-user-doc --> |
@@ -2834,6 +2870,24 @@ public interface LogiclanguagePackage extends EPackage { | |||
2834 | int SUM__RELATION = PROJECTED_AGGREGATE_EXPRESSION__RELATION; | 2870 | int SUM__RELATION = PROJECTED_AGGREGATE_EXPRESSION__RELATION; |
2835 | 2871 | ||
2836 | /** | 2872 | /** |
2873 | * The feature id for the '<em><b>Parameter Substitution</b></em>' containment reference list. | ||
2874 | * <!-- begin-user-doc --> | ||
2875 | * <!-- end-user-doc --> | ||
2876 | * @generated | ||
2877 | * @ordered | ||
2878 | */ | ||
2879 | int SUM__PARAMETER_SUBSTITUTION = PROJECTED_AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION; | ||
2880 | |||
2881 | /** | ||
2882 | * The feature id for the '<em><b>Result Variable</b></em>' reference. | ||
2883 | * <!-- begin-user-doc --> | ||
2884 | * <!-- end-user-doc --> | ||
2885 | * @generated | ||
2886 | * @ordered | ||
2887 | */ | ||
2888 | int SUM__RESULT_VARIABLE = PROJECTED_AGGREGATE_EXPRESSION__RESULT_VARIABLE; | ||
2889 | |||
2890 | /** | ||
2837 | * The feature id for the '<em><b>Projection Index</b></em>' attribute. | 2891 | * The feature id for the '<em><b>Projection Index</b></em>' attribute. |
2838 | * <!-- begin-user-doc --> | 2892 | * <!-- begin-user-doc --> |
2839 | * <!-- end-user-doc --> | 2893 | * <!-- end-user-doc --> |
@@ -2880,6 +2934,24 @@ public interface LogiclanguagePackage extends EPackage { | |||
2880 | int COUNT__RELATION = AGGREGATE_EXPRESSION__RELATION; | 2934 | int COUNT__RELATION = AGGREGATE_EXPRESSION__RELATION; |
2881 | 2935 | ||
2882 | /** | 2936 | /** |
2937 | * The feature id for the '<em><b>Parameter Substitution</b></em>' containment reference list. | ||
2938 | * <!-- begin-user-doc --> | ||
2939 | * <!-- end-user-doc --> | ||
2940 | * @generated | ||
2941 | * @ordered | ||
2942 | */ | ||
2943 | int COUNT__PARAMETER_SUBSTITUTION = AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION; | ||
2944 | |||
2945 | /** | ||
2946 | * The feature id for the '<em><b>Result Variable</b></em>' reference. | ||
2947 | * <!-- begin-user-doc --> | ||
2948 | * <!-- end-user-doc --> | ||
2949 | * @generated | ||
2950 | * @ordered | ||
2951 | */ | ||
2952 | int COUNT__RESULT_VARIABLE = AGGREGATE_EXPRESSION__RESULT_VARIABLE; | ||
2953 | |||
2954 | /** | ||
2883 | * The number of structural features of the '<em>Count</em>' class. | 2955 | * The number of structural features of the '<em>Count</em>' class. |
2884 | * <!-- begin-user-doc --> | 2956 | * <!-- begin-user-doc --> |
2885 | * <!-- end-user-doc --> | 2957 | * <!-- end-user-doc --> |
@@ -2917,6 +2989,24 @@ public interface LogiclanguagePackage extends EPackage { | |||
2917 | int MIN__RELATION = PROJECTED_AGGREGATE_EXPRESSION__RELATION; | 2989 | int MIN__RELATION = PROJECTED_AGGREGATE_EXPRESSION__RELATION; |
2918 | 2990 | ||
2919 | /** | 2991 | /** |
2992 | * The feature id for the '<em><b>Parameter Substitution</b></em>' containment reference list. | ||
2993 | * <!-- begin-user-doc --> | ||
2994 | * <!-- end-user-doc --> | ||
2995 | * @generated | ||
2996 | * @ordered | ||
2997 | */ | ||
2998 | int MIN__PARAMETER_SUBSTITUTION = PROJECTED_AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION; | ||
2999 | |||
3000 | /** | ||
3001 | * The feature id for the '<em><b>Result Variable</b></em>' reference. | ||
3002 | * <!-- begin-user-doc --> | ||
3003 | * <!-- end-user-doc --> | ||
3004 | * @generated | ||
3005 | * @ordered | ||
3006 | */ | ||
3007 | int MIN__RESULT_VARIABLE = PROJECTED_AGGREGATE_EXPRESSION__RESULT_VARIABLE; | ||
3008 | |||
3009 | /** | ||
2920 | * The feature id for the '<em><b>Projection Index</b></em>' attribute. | 3010 | * The feature id for the '<em><b>Projection Index</b></em>' attribute. |
2921 | * <!-- begin-user-doc --> | 3011 | * <!-- begin-user-doc --> |
2922 | * <!-- end-user-doc --> | 3012 | * <!-- end-user-doc --> |
@@ -2963,6 +3053,24 @@ public interface LogiclanguagePackage extends EPackage { | |||
2963 | int MAX__RELATION = PROJECTED_AGGREGATE_EXPRESSION__RELATION; | 3053 | int MAX__RELATION = PROJECTED_AGGREGATE_EXPRESSION__RELATION; |
2964 | 3054 | ||
2965 | /** | 3055 | /** |
3056 | * The feature id for the '<em><b>Parameter Substitution</b></em>' containment reference list. | ||
3057 | * <!-- begin-user-doc --> | ||
3058 | * <!-- end-user-doc --> | ||
3059 | * @generated | ||
3060 | * @ordered | ||
3061 | */ | ||
3062 | int MAX__PARAMETER_SUBSTITUTION = PROJECTED_AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION; | ||
3063 | |||
3064 | /** | ||
3065 | * The feature id for the '<em><b>Result Variable</b></em>' reference. | ||
3066 | * <!-- begin-user-doc --> | ||
3067 | * <!-- end-user-doc --> | ||
3068 | * @generated | ||
3069 | * @ordered | ||
3070 | */ | ||
3071 | int MAX__RESULT_VARIABLE = PROJECTED_AGGREGATE_EXPRESSION__RESULT_VARIABLE; | ||
3072 | |||
3073 | /** | ||
2966 | * The feature id for the '<em><b>Projection Index</b></em>' attribute. | 3074 | * The feature id for the '<em><b>Projection Index</b></em>' attribute. |
2967 | * <!-- begin-user-doc --> | 3075 | * <!-- begin-user-doc --> |
2968 | * <!-- end-user-doc --> | 3076 | * <!-- end-user-doc --> |
@@ -2991,6 +3099,44 @@ public interface LogiclanguagePackage extends EPackage { | |||
2991 | 3099 | ||
2992 | 3100 | ||
2993 | /** | 3101 | /** |
3102 | * The meta object id for the '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AggregatedParameterSubstitutionImpl <em>Aggregated Parameter Substitution</em>}' class. | ||
3103 | * <!-- begin-user-doc --> | ||
3104 | * <!-- end-user-doc --> | ||
3105 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AggregatedParameterSubstitutionImpl | ||
3106 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.LogiclanguagePackageImpl#getAggregatedParameterSubstitution() | ||
3107 | * @generated | ||
3108 | */ | ||
3109 | int AGGREGATED_PARAMETER_SUBSTITUTION = 65; | ||
3110 | |||
3111 | /** | ||
3112 | * The feature id for the '<em><b>Variable</b></em>' reference. | ||
3113 | * <!-- begin-user-doc --> | ||
3114 | * <!-- end-user-doc --> | ||
3115 | * @generated | ||
3116 | * @ordered | ||
3117 | */ | ||
3118 | int AGGREGATED_PARAMETER_SUBSTITUTION__VARIABLE = 0; | ||
3119 | |||
3120 | /** | ||
3121 | * The number of structural features of the '<em>Aggregated Parameter Substitution</em>' class. | ||
3122 | * <!-- begin-user-doc --> | ||
3123 | * <!-- end-user-doc --> | ||
3124 | * @generated | ||
3125 | * @ordered | ||
3126 | */ | ||
3127 | int AGGREGATED_PARAMETER_SUBSTITUTION_FEATURE_COUNT = 1; | ||
3128 | |||
3129 | /** | ||
3130 | * The number of operations of the '<em>Aggregated Parameter Substitution</em>' class. | ||
3131 | * <!-- begin-user-doc --> | ||
3132 | * <!-- end-user-doc --> | ||
3133 | * @generated | ||
3134 | * @ordered | ||
3135 | */ | ||
3136 | int AGGREGATED_PARAMETER_SUBSTITUTION_OPERATION_COUNT = 0; | ||
3137 | |||
3138 | |||
3139 | /** | ||
2994 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type <em>Type</em>}'. | 3140 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type <em>Type</em>}'. |
2995 | * <!-- begin-user-doc --> | 3141 | * <!-- begin-user-doc --> |
2996 | * <!-- end-user-doc --> | 3142 | * <!-- end-user-doc --> |
@@ -4306,6 +4452,28 @@ public interface LogiclanguagePackage extends EPackage { | |||
4306 | EReference getAggregateExpression_Relation(); | 4452 | EReference getAggregateExpression_Relation(); |
4307 | 4453 | ||
4308 | /** | 4454 | /** |
4455 | * Returns the meta object for the containment reference list '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression#getParameterSubstitution <em>Parameter Substitution</em>}'. | ||
4456 | * <!-- begin-user-doc --> | ||
4457 | * <!-- end-user-doc --> | ||
4458 | * @return the meta object for the containment reference list '<em>Parameter Substitution</em>'. | ||
4459 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression#getParameterSubstitution() | ||
4460 | * @see #getAggregateExpression() | ||
4461 | * @generated | ||
4462 | */ | ||
4463 | EReference getAggregateExpression_ParameterSubstitution(); | ||
4464 | |||
4465 | /** | ||
4466 | * Returns the meta object for the reference '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression#getResultVariable <em>Result Variable</em>}'. | ||
4467 | * <!-- begin-user-doc --> | ||
4468 | * <!-- end-user-doc --> | ||
4469 | * @return the meta object for the reference '<em>Result Variable</em>'. | ||
4470 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression#getResultVariable() | ||
4471 | * @see #getAggregateExpression() | ||
4472 | * @generated | ||
4473 | */ | ||
4474 | EReference getAggregateExpression_ResultVariable(); | ||
4475 | |||
4476 | /** | ||
4309 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Sum <em>Sum</em>}'. | 4477 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Sum <em>Sum</em>}'. |
4310 | * <!-- begin-user-doc --> | 4478 | * <!-- begin-user-doc --> |
4311 | * <!-- end-user-doc --> | 4479 | * <!-- end-user-doc --> |
@@ -4367,6 +4535,27 @@ public interface LogiclanguagePackage extends EPackage { | |||
4367 | EAttribute getProjectedAggregateExpression_ProjectionIndex(); | 4535 | EAttribute getProjectedAggregateExpression_ProjectionIndex(); |
4368 | 4536 | ||
4369 | /** | 4537 | /** |
4538 | * Returns the meta object for class '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution <em>Aggregated Parameter Substitution</em>}'. | ||
4539 | * <!-- begin-user-doc --> | ||
4540 | * <!-- end-user-doc --> | ||
4541 | * @return the meta object for class '<em>Aggregated Parameter Substitution</em>'. | ||
4542 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution | ||
4543 | * @generated | ||
4544 | */ | ||
4545 | EClass getAggregatedParameterSubstitution(); | ||
4546 | |||
4547 | /** | ||
4548 | * Returns the meta object for the reference '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution#getVariable <em>Variable</em>}'. | ||
4549 | * <!-- begin-user-doc --> | ||
4550 | * <!-- end-user-doc --> | ||
4551 | * @return the meta object for the reference '<em>Variable</em>'. | ||
4552 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution#getVariable() | ||
4553 | * @see #getAggregatedParameterSubstitution() | ||
4554 | * @generated | ||
4555 | */ | ||
4556 | EReference getAggregatedParameterSubstitution_Variable(); | ||
4557 | |||
4558 | /** | ||
4370 | * Returns the factory that creates the instances of the model. | 4559 | * Returns the factory that creates the instances of the model. |
4371 | * <!-- begin-user-doc --> | 4560 | * <!-- begin-user-doc --> |
4372 | * <!-- end-user-doc --> | 4561 | * <!-- end-user-doc --> |
@@ -5510,6 +5699,22 @@ public interface LogiclanguagePackage extends EPackage { | |||
5510 | EReference AGGREGATE_EXPRESSION__RELATION = eINSTANCE.getAggregateExpression_Relation(); | 5699 | EReference AGGREGATE_EXPRESSION__RELATION = eINSTANCE.getAggregateExpression_Relation(); |
5511 | 5700 | ||
5512 | /** | 5701 | /** |
5702 | * The meta object literal for the '<em><b>Parameter Substitution</b></em>' containment reference list feature. | ||
5703 | * <!-- begin-user-doc --> | ||
5704 | * <!-- end-user-doc --> | ||
5705 | * @generated | ||
5706 | */ | ||
5707 | EReference AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION = eINSTANCE.getAggregateExpression_ParameterSubstitution(); | ||
5708 | |||
5709 | /** | ||
5710 | * The meta object literal for the '<em><b>Result Variable</b></em>' reference feature. | ||
5711 | * <!-- begin-user-doc --> | ||
5712 | * <!-- end-user-doc --> | ||
5713 | * @generated | ||
5714 | */ | ||
5715 | EReference AGGREGATE_EXPRESSION__RESULT_VARIABLE = eINSTANCE.getAggregateExpression_ResultVariable(); | ||
5716 | |||
5717 | /** | ||
5513 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.SumImpl <em>Sum</em>}' class. | 5718 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.SumImpl <em>Sum</em>}' class. |
5514 | * <!-- begin-user-doc --> | 5719 | * <!-- begin-user-doc --> |
5515 | * <!-- end-user-doc --> | 5720 | * <!-- end-user-doc --> |
@@ -5567,6 +5772,24 @@ public interface LogiclanguagePackage extends EPackage { | |||
5567 | */ | 5772 | */ |
5568 | EAttribute PROJECTED_AGGREGATE_EXPRESSION__PROJECTION_INDEX = eINSTANCE.getProjectedAggregateExpression_ProjectionIndex(); | 5773 | EAttribute PROJECTED_AGGREGATE_EXPRESSION__PROJECTION_INDEX = eINSTANCE.getProjectedAggregateExpression_ProjectionIndex(); |
5569 | 5774 | ||
5775 | /** | ||
5776 | * The meta object literal for the '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AggregatedParameterSubstitutionImpl <em>Aggregated Parameter Substitution</em>}' class. | ||
5777 | * <!-- begin-user-doc --> | ||
5778 | * <!-- end-user-doc --> | ||
5779 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AggregatedParameterSubstitutionImpl | ||
5780 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.LogiclanguagePackageImpl#getAggregatedParameterSubstitution() | ||
5781 | * @generated | ||
5782 | */ | ||
5783 | EClass AGGREGATED_PARAMETER_SUBSTITUTION = eINSTANCE.getAggregatedParameterSubstitution(); | ||
5784 | |||
5785 | /** | ||
5786 | * The meta object literal for the '<em><b>Variable</b></em>' reference feature. | ||
5787 | * <!-- begin-user-doc --> | ||
5788 | * <!-- end-user-doc --> | ||
5789 | * @generated | ||
5790 | */ | ||
5791 | EReference AGGREGATED_PARAMETER_SUBSTITUTION__VARIABLE = eINSTANCE.getAggregatedParameterSubstitution_Variable(); | ||
5792 | |||
5570 | } | 5793 | } |
5571 | 5794 | ||
5572 | } //LogiclanguagePackage | 5795 | } //LogiclanguagePackage |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/AggregateExpressionImpl.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/AggregateExpressionImpl.java index fc1420b0..31155b84 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/AggregateExpressionImpl.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/AggregateExpressionImpl.java | |||
@@ -3,15 +3,22 @@ | |||
3 | package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl; | 3 | package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl; |
4 | 4 | ||
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression; | 5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression; |
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution; | ||
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage; | 7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage; |
7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Relation; | 8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Relation; |
8 | 9 | ||
10 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Variable; | ||
11 | import java.util.Collection; | ||
9 | import org.eclipse.emf.common.notify.Notification; | 12 | import org.eclipse.emf.common.notify.Notification; |
10 | 13 | ||
14 | import org.eclipse.emf.common.notify.NotificationChain; | ||
15 | import org.eclipse.emf.common.util.EList; | ||
11 | import org.eclipse.emf.ecore.EClass; | 16 | import org.eclipse.emf.ecore.EClass; |
12 | import org.eclipse.emf.ecore.InternalEObject; | 17 | import org.eclipse.emf.ecore.InternalEObject; |
13 | 18 | ||
14 | import org.eclipse.emf.ecore.impl.ENotificationImpl; | 19 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
20 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; | ||
21 | import org.eclipse.emf.ecore.util.InternalEList; | ||
15 | 22 | ||
16 | /** | 23 | /** |
17 | * <!-- begin-user-doc --> | 24 | * <!-- begin-user-doc --> |
@@ -22,6 +29,8 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl; | |||
22 | * </p> | 29 | * </p> |
23 | * <ul> | 30 | * <ul> |
24 | * <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AggregateExpressionImpl#getRelation <em>Relation</em>}</li> | 31 | * <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AggregateExpressionImpl#getRelation <em>Relation</em>}</li> |
32 | * <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AggregateExpressionImpl#getParameterSubstitution <em>Parameter Substitution</em>}</li> | ||
33 | * <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AggregateExpressionImpl#getResultVariable <em>Result Variable</em>}</li> | ||
25 | * </ul> | 34 | * </ul> |
26 | * | 35 | * |
27 | * @generated | 36 | * @generated |
@@ -38,6 +47,26 @@ public abstract class AggregateExpressionImpl extends TermImpl implements Aggreg | |||
38 | protected Relation relation; | 47 | protected Relation relation; |
39 | 48 | ||
40 | /** | 49 | /** |
50 | * The cached value of the '{@link #getParameterSubstitution() <em>Parameter Substitution</em>}' containment reference list. | ||
51 | * <!-- begin-user-doc --> | ||
52 | * <!-- end-user-doc --> | ||
53 | * @see #getParameterSubstitution() | ||
54 | * @generated | ||
55 | * @ordered | ||
56 | */ | ||
57 | protected EList<AggregatedParameterSubstitution> parameterSubstitution; | ||
58 | |||
59 | /** | ||
60 | * The cached value of the '{@link #getResultVariable() <em>Result Variable</em>}' reference. | ||
61 | * <!-- begin-user-doc --> | ||
62 | * <!-- end-user-doc --> | ||
63 | * @see #getResultVariable() | ||
64 | * @generated | ||
65 | * @ordered | ||
66 | */ | ||
67 | protected Variable resultVariable; | ||
68 | |||
69 | /** | ||
41 | * <!-- begin-user-doc --> | 70 | * <!-- begin-user-doc --> |
42 | * <!-- end-user-doc --> | 71 | * <!-- end-user-doc --> |
43 | * @generated | 72 | * @generated |
@@ -102,11 +131,83 @@ public abstract class AggregateExpressionImpl extends TermImpl implements Aggreg | |||
102 | * @generated | 131 | * @generated |
103 | */ | 132 | */ |
104 | @Override | 133 | @Override |
134 | public EList<AggregatedParameterSubstitution> getParameterSubstitution() { | ||
135 | if (parameterSubstitution == null) { | ||
136 | parameterSubstitution = new EObjectContainmentEList<AggregatedParameterSubstitution>(AggregatedParameterSubstitution.class, this, LogiclanguagePackage.AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION); | ||
137 | } | ||
138 | return parameterSubstitution; | ||
139 | } | ||
140 | |||
141 | /** | ||
142 | * <!-- begin-user-doc --> | ||
143 | * <!-- end-user-doc --> | ||
144 | * @generated | ||
145 | */ | ||
146 | @Override | ||
147 | public Variable getResultVariable() { | ||
148 | if (resultVariable != null && resultVariable.eIsProxy()) { | ||
149 | InternalEObject oldResultVariable = (InternalEObject)resultVariable; | ||
150 | resultVariable = (Variable)eResolveProxy(oldResultVariable); | ||
151 | if (resultVariable != oldResultVariable) { | ||
152 | if (eNotificationRequired()) | ||
153 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, LogiclanguagePackage.AGGREGATE_EXPRESSION__RESULT_VARIABLE, oldResultVariable, resultVariable)); | ||
154 | } | ||
155 | } | ||
156 | return resultVariable; | ||
157 | } | ||
158 | |||
159 | /** | ||
160 | * <!-- begin-user-doc --> | ||
161 | * <!-- end-user-doc --> | ||
162 | * @generated | ||
163 | */ | ||
164 | public Variable basicGetResultVariable() { | ||
165 | return resultVariable; | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * <!-- begin-user-doc --> | ||
170 | * <!-- end-user-doc --> | ||
171 | * @generated | ||
172 | */ | ||
173 | @Override | ||
174 | public void setResultVariable(Variable newResultVariable) { | ||
175 | Variable oldResultVariable = resultVariable; | ||
176 | resultVariable = newResultVariable; | ||
177 | if (eNotificationRequired()) | ||
178 | eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.AGGREGATE_EXPRESSION__RESULT_VARIABLE, oldResultVariable, resultVariable)); | ||
179 | } | ||
180 | |||
181 | /** | ||
182 | * <!-- begin-user-doc --> | ||
183 | * <!-- end-user-doc --> | ||
184 | * @generated | ||
185 | */ | ||
186 | @Override | ||
187 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
188 | switch (featureID) { | ||
189 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION: | ||
190 | return ((InternalEList<?>)getParameterSubstitution()).basicRemove(otherEnd, msgs); | ||
191 | } | ||
192 | return super.eInverseRemove(otherEnd, featureID, msgs); | ||
193 | } | ||
194 | |||
195 | /** | ||
196 | * <!-- begin-user-doc --> | ||
197 | * <!-- end-user-doc --> | ||
198 | * @generated | ||
199 | */ | ||
200 | @Override | ||
105 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | 201 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
106 | switch (featureID) { | 202 | switch (featureID) { |
107 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RELATION: | 203 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RELATION: |
108 | if (resolve) return getRelation(); | 204 | if (resolve) return getRelation(); |
109 | return basicGetRelation(); | 205 | return basicGetRelation(); |
206 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION: | ||
207 | return getParameterSubstitution(); | ||
208 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RESULT_VARIABLE: | ||
209 | if (resolve) return getResultVariable(); | ||
210 | return basicGetResultVariable(); | ||
110 | } | 211 | } |
111 | return super.eGet(featureID, resolve, coreType); | 212 | return super.eGet(featureID, resolve, coreType); |
112 | } | 213 | } |
@@ -116,12 +217,20 @@ public abstract class AggregateExpressionImpl extends TermImpl implements Aggreg | |||
116 | * <!-- end-user-doc --> | 217 | * <!-- end-user-doc --> |
117 | * @generated | 218 | * @generated |
118 | */ | 219 | */ |
220 | @SuppressWarnings("unchecked") | ||
119 | @Override | 221 | @Override |
120 | public void eSet(int featureID, Object newValue) { | 222 | public void eSet(int featureID, Object newValue) { |
121 | switch (featureID) { | 223 | switch (featureID) { |
122 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RELATION: | 224 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RELATION: |
123 | setRelation((Relation)newValue); | 225 | setRelation((Relation)newValue); |
124 | return; | 226 | return; |
227 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION: | ||
228 | getParameterSubstitution().clear(); | ||
229 | getParameterSubstitution().addAll((Collection<? extends AggregatedParameterSubstitution>)newValue); | ||
230 | return; | ||
231 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RESULT_VARIABLE: | ||
232 | setResultVariable((Variable)newValue); | ||
233 | return; | ||
125 | } | 234 | } |
126 | super.eSet(featureID, newValue); | 235 | super.eSet(featureID, newValue); |
127 | } | 236 | } |
@@ -137,6 +246,12 @@ public abstract class AggregateExpressionImpl extends TermImpl implements Aggreg | |||
137 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RELATION: | 246 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RELATION: |
138 | setRelation((Relation)null); | 247 | setRelation((Relation)null); |
139 | return; | 248 | return; |
249 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION: | ||
250 | getParameterSubstitution().clear(); | ||
251 | return; | ||
252 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RESULT_VARIABLE: | ||
253 | setResultVariable((Variable)null); | ||
254 | return; | ||
140 | } | 255 | } |
141 | super.eUnset(featureID); | 256 | super.eUnset(featureID); |
142 | } | 257 | } |
@@ -151,6 +266,10 @@ public abstract class AggregateExpressionImpl extends TermImpl implements Aggreg | |||
151 | switch (featureID) { | 266 | switch (featureID) { |
152 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RELATION: | 267 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RELATION: |
153 | return relation != null; | 268 | return relation != null; |
269 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION: | ||
270 | return parameterSubstitution != null && !parameterSubstitution.isEmpty(); | ||
271 | case LogiclanguagePackage.AGGREGATE_EXPRESSION__RESULT_VARIABLE: | ||
272 | return resultVariable != null; | ||
154 | } | 273 | } |
155 | return super.eIsSet(featureID); | 274 | return super.eIsSet(featureID); |
156 | } | 275 | } |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/AggregatedParameterSubstitutionImpl.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/AggregatedParameterSubstitutionImpl.java new file mode 100644 index 00000000..15af0f21 --- /dev/null +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/AggregatedParameterSubstitutionImpl.java | |||
@@ -0,0 +1,159 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl; | ||
4 | |||
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution; | ||
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage; | ||
7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Variable; | ||
8 | |||
9 | import org.eclipse.emf.common.notify.Notification; | ||
10 | |||
11 | import org.eclipse.emf.ecore.EClass; | ||
12 | import org.eclipse.emf.ecore.InternalEObject; | ||
13 | |||
14 | import org.eclipse.emf.ecore.impl.ENotificationImpl; | ||
15 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; | ||
16 | |||
17 | /** | ||
18 | * <!-- begin-user-doc --> | ||
19 | * An implementation of the model object '<em><b>Aggregated Parameter Substitution</b></em>'. | ||
20 | * <!-- end-user-doc --> | ||
21 | * <p> | ||
22 | * The following features are implemented: | ||
23 | * </p> | ||
24 | * <ul> | ||
25 | * <li>{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AggregatedParameterSubstitutionImpl#getVariable <em>Variable</em>}</li> | ||
26 | * </ul> | ||
27 | * | ||
28 | * @generated | ||
29 | */ | ||
30 | public class AggregatedParameterSubstitutionImpl extends MinimalEObjectImpl.Container implements AggregatedParameterSubstitution { | ||
31 | /** | ||
32 | * The cached value of the '{@link #getVariable() <em>Variable</em>}' reference. | ||
33 | * <!-- begin-user-doc --> | ||
34 | * <!-- end-user-doc --> | ||
35 | * @see #getVariable() | ||
36 | * @generated | ||
37 | * @ordered | ||
38 | */ | ||
39 | protected Variable variable; | ||
40 | |||
41 | /** | ||
42 | * <!-- begin-user-doc --> | ||
43 | * <!-- end-user-doc --> | ||
44 | * @generated | ||
45 | */ | ||
46 | protected AggregatedParameterSubstitutionImpl() { | ||
47 | super(); | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * <!-- begin-user-doc --> | ||
52 | * <!-- end-user-doc --> | ||
53 | * @generated | ||
54 | */ | ||
55 | @Override | ||
56 | protected EClass eStaticClass() { | ||
57 | return LogiclanguagePackage.Literals.AGGREGATED_PARAMETER_SUBSTITUTION; | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * <!-- begin-user-doc --> | ||
62 | * <!-- end-user-doc --> | ||
63 | * @generated | ||
64 | */ | ||
65 | @Override | ||
66 | public Variable getVariable() { | ||
67 | if (variable != null && variable.eIsProxy()) { | ||
68 | InternalEObject oldVariable = (InternalEObject)variable; | ||
69 | variable = (Variable)eResolveProxy(oldVariable); | ||
70 | if (variable != oldVariable) { | ||
71 | if (eNotificationRequired()) | ||
72 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, LogiclanguagePackage.AGGREGATED_PARAMETER_SUBSTITUTION__VARIABLE, oldVariable, variable)); | ||
73 | } | ||
74 | } | ||
75 | return variable; | ||
76 | } | ||
77 | |||
78 | /** | ||
79 | * <!-- begin-user-doc --> | ||
80 | * <!-- end-user-doc --> | ||
81 | * @generated | ||
82 | */ | ||
83 | public Variable basicGetVariable() { | ||
84 | return variable; | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * <!-- begin-user-doc --> | ||
89 | * <!-- end-user-doc --> | ||
90 | * @generated | ||
91 | */ | ||
92 | @Override | ||
93 | public void setVariable(Variable newVariable) { | ||
94 | Variable oldVariable = variable; | ||
95 | variable = newVariable; | ||
96 | if (eNotificationRequired()) | ||
97 | eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.AGGREGATED_PARAMETER_SUBSTITUTION__VARIABLE, oldVariable, variable)); | ||
98 | } | ||
99 | |||
100 | /** | ||
101 | * <!-- begin-user-doc --> | ||
102 | * <!-- end-user-doc --> | ||
103 | * @generated | ||
104 | */ | ||
105 | @Override | ||
106 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | ||
107 | switch (featureID) { | ||
108 | case LogiclanguagePackage.AGGREGATED_PARAMETER_SUBSTITUTION__VARIABLE: | ||
109 | if (resolve) return getVariable(); | ||
110 | return basicGetVariable(); | ||
111 | } | ||
112 | return super.eGet(featureID, resolve, coreType); | ||
113 | } | ||
114 | |||
115 | /** | ||
116 | * <!-- begin-user-doc --> | ||
117 | * <!-- end-user-doc --> | ||
118 | * @generated | ||
119 | */ | ||
120 | @Override | ||
121 | public void eSet(int featureID, Object newValue) { | ||
122 | switch (featureID) { | ||
123 | case LogiclanguagePackage.AGGREGATED_PARAMETER_SUBSTITUTION__VARIABLE: | ||
124 | setVariable((Variable)newValue); | ||
125 | return; | ||
126 | } | ||
127 | super.eSet(featureID, newValue); | ||
128 | } | ||
129 | |||
130 | /** | ||
131 | * <!-- begin-user-doc --> | ||
132 | * <!-- end-user-doc --> | ||
133 | * @generated | ||
134 | */ | ||
135 | @Override | ||
136 | public void eUnset(int featureID) { | ||
137 | switch (featureID) { | ||
138 | case LogiclanguagePackage.AGGREGATED_PARAMETER_SUBSTITUTION__VARIABLE: | ||
139 | setVariable((Variable)null); | ||
140 | return; | ||
141 | } | ||
142 | super.eUnset(featureID); | ||
143 | } | ||
144 | |||
145 | /** | ||
146 | * <!-- begin-user-doc --> | ||
147 | * <!-- end-user-doc --> | ||
148 | * @generated | ||
149 | */ | ||
150 | @Override | ||
151 | public boolean eIsSet(int featureID) { | ||
152 | switch (featureID) { | ||
153 | case LogiclanguagePackage.AGGREGATED_PARAMETER_SUBSTITUTION__VARIABLE: | ||
154 | return variable != null; | ||
155 | } | ||
156 | return super.eIsSet(featureID); | ||
157 | } | ||
158 | |||
159 | } //AggregatedParameterSubstitutionImpl | ||
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguageFactoryImpl.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguageFactoryImpl.java index b890b6e0..b8d87d99 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguageFactoryImpl.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguageFactoryImpl.java | |||
@@ -104,6 +104,7 @@ public class LogiclanguageFactoryImpl extends EFactoryImpl implements Logiclangu | |||
104 | case LogiclanguagePackage.COUNT: return createCount(); | 104 | case LogiclanguagePackage.COUNT: return createCount(); |
105 | case LogiclanguagePackage.MIN: return createMin(); | 105 | case LogiclanguagePackage.MIN: return createMin(); |
106 | case LogiclanguagePackage.MAX: return createMax(); | 106 | case LogiclanguagePackage.MAX: return createMax(); |
107 | case LogiclanguagePackage.AGGREGATED_PARAMETER_SUBSTITUTION: return createAggregatedParameterSubstitution(); | ||
107 | default: | 108 | default: |
108 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); | 109 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
109 | } | 110 | } |
@@ -643,6 +644,17 @@ public class LogiclanguageFactoryImpl extends EFactoryImpl implements Logiclangu | |||
643 | * @generated | 644 | * @generated |
644 | */ | 645 | */ |
645 | @Override | 646 | @Override |
647 | public AggregatedParameterSubstitution createAggregatedParameterSubstitution() { | ||
648 | AggregatedParameterSubstitutionImpl aggregatedParameterSubstitution = new AggregatedParameterSubstitutionImpl(); | ||
649 | return aggregatedParameterSubstitution; | ||
650 | } | ||
651 | |||
652 | /** | ||
653 | * <!-- begin-user-doc --> | ||
654 | * <!-- end-user-doc --> | ||
655 | * @generated | ||
656 | */ | ||
657 | @Override | ||
646 | public LogiclanguagePackage getLogiclanguagePackage() { | 658 | public LogiclanguagePackage getLogiclanguagePackage() { |
647 | return (LogiclanguagePackage)getEPackage(); | 659 | return (LogiclanguagePackage)getEPackage(); |
648 | } | 660 | } |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguagePackageImpl.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguagePackageImpl.java index 6d370c0f..03a679e4 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguagePackageImpl.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguagePackageImpl.java | |||
@@ -3,6 +3,7 @@ | |||
3 | package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl; | 3 | package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl; |
4 | 4 | ||
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression; | 5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression; |
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution; | ||
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.And; | 7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.And; |
7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Assertion; | 8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Assertion; |
8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AtomicTerm; | 9 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AtomicTerm; |
@@ -548,6 +549,13 @@ public class LogiclanguagePackageImpl extends EPackageImpl implements Logiclangu | |||
548 | private EClass projectedAggregateExpressionEClass = null; | 549 | private EClass projectedAggregateExpressionEClass = null; |
549 | 550 | ||
550 | /** | 551 | /** |
552 | * <!-- begin-user-doc --> | ||
553 | * <!-- end-user-doc --> | ||
554 | * @generated | ||
555 | */ | ||
556 | private EClass aggregatedParameterSubstitutionEClass = null; | ||
557 | |||
558 | /** | ||
551 | * Creates an instance of the model <b>Package</b>, registered with | 559 | * Creates an instance of the model <b>Package</b>, registered with |
552 | * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package | 560 | * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package |
553 | * package URI value. | 561 | * package URI value. |
@@ -1874,6 +1882,26 @@ public class LogiclanguagePackageImpl extends EPackageImpl implements Logiclangu | |||
1874 | * @generated | 1882 | * @generated |
1875 | */ | 1883 | */ |
1876 | @Override | 1884 | @Override |
1885 | public EReference getAggregateExpression_ParameterSubstitution() { | ||
1886 | return (EReference)aggregateExpressionEClass.getEStructuralFeatures().get(1); | ||
1887 | } | ||
1888 | |||
1889 | /** | ||
1890 | * <!-- begin-user-doc --> | ||
1891 | * <!-- end-user-doc --> | ||
1892 | * @generated | ||
1893 | */ | ||
1894 | @Override | ||
1895 | public EReference getAggregateExpression_ResultVariable() { | ||
1896 | return (EReference)aggregateExpressionEClass.getEStructuralFeatures().get(2); | ||
1897 | } | ||
1898 | |||
1899 | /** | ||
1900 | * <!-- begin-user-doc --> | ||
1901 | * <!-- end-user-doc --> | ||
1902 | * @generated | ||
1903 | */ | ||
1904 | @Override | ||
1877 | public EClass getSum() { | 1905 | public EClass getSum() { |
1878 | return sumEClass; | 1906 | return sumEClass; |
1879 | } | 1907 | } |
@@ -1934,6 +1962,26 @@ public class LogiclanguagePackageImpl extends EPackageImpl implements Logiclangu | |||
1934 | * @generated | 1962 | * @generated |
1935 | */ | 1963 | */ |
1936 | @Override | 1964 | @Override |
1965 | public EClass getAggregatedParameterSubstitution() { | ||
1966 | return aggregatedParameterSubstitutionEClass; | ||
1967 | } | ||
1968 | |||
1969 | /** | ||
1970 | * <!-- begin-user-doc --> | ||
1971 | * <!-- end-user-doc --> | ||
1972 | * @generated | ||
1973 | */ | ||
1974 | @Override | ||
1975 | public EReference getAggregatedParameterSubstitution_Variable() { | ||
1976 | return (EReference)aggregatedParameterSubstitutionEClass.getEStructuralFeatures().get(0); | ||
1977 | } | ||
1978 | |||
1979 | /** | ||
1980 | * <!-- begin-user-doc --> | ||
1981 | * <!-- end-user-doc --> | ||
1982 | * @generated | ||
1983 | */ | ||
1984 | @Override | ||
1937 | public LogiclanguageFactory getLogiclanguageFactory() { | 1985 | public LogiclanguageFactory getLogiclanguageFactory() { |
1938 | return (LogiclanguageFactory)getEFactoryInstance(); | 1986 | return (LogiclanguageFactory)getEFactoryInstance(); |
1939 | } | 1987 | } |
@@ -2141,6 +2189,8 @@ public class LogiclanguagePackageImpl extends EPackageImpl implements Logiclangu | |||
2141 | 2189 | ||
2142 | aggregateExpressionEClass = createEClass(AGGREGATE_EXPRESSION); | 2190 | aggregateExpressionEClass = createEClass(AGGREGATE_EXPRESSION); |
2143 | createEReference(aggregateExpressionEClass, AGGREGATE_EXPRESSION__RELATION); | 2191 | createEReference(aggregateExpressionEClass, AGGREGATE_EXPRESSION__RELATION); |
2192 | createEReference(aggregateExpressionEClass, AGGREGATE_EXPRESSION__PARAMETER_SUBSTITUTION); | ||
2193 | createEReference(aggregateExpressionEClass, AGGREGATE_EXPRESSION__RESULT_VARIABLE); | ||
2144 | 2194 | ||
2145 | sumEClass = createEClass(SUM); | 2195 | sumEClass = createEClass(SUM); |
2146 | 2196 | ||
@@ -2152,6 +2202,9 @@ public class LogiclanguagePackageImpl extends EPackageImpl implements Logiclangu | |||
2152 | 2202 | ||
2153 | projectedAggregateExpressionEClass = createEClass(PROJECTED_AGGREGATE_EXPRESSION); | 2203 | projectedAggregateExpressionEClass = createEClass(PROJECTED_AGGREGATE_EXPRESSION); |
2154 | createEAttribute(projectedAggregateExpressionEClass, PROJECTED_AGGREGATE_EXPRESSION__PROJECTION_INDEX); | 2204 | createEAttribute(projectedAggregateExpressionEClass, PROJECTED_AGGREGATE_EXPRESSION__PROJECTION_INDEX); |
2205 | |||
2206 | aggregatedParameterSubstitutionEClass = createEClass(AGGREGATED_PARAMETER_SUBSTITUTION); | ||
2207 | createEReference(aggregatedParameterSubstitutionEClass, AGGREGATED_PARAMETER_SUBSTITUTION__VARIABLE); | ||
2155 | } | 2208 | } |
2156 | 2209 | ||
2157 | /** | 2210 | /** |
@@ -2433,6 +2486,8 @@ public class LogiclanguagePackageImpl extends EPackageImpl implements Logiclangu | |||
2433 | 2486 | ||
2434 | initEClass(aggregateExpressionEClass, AggregateExpression.class, "AggregateExpression", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | 2487 | initEClass(aggregateExpressionEClass, AggregateExpression.class, "AggregateExpression", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
2435 | initEReference(getAggregateExpression_Relation(), this.getRelation(), null, "relation", null, 0, 1, AggregateExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | 2488 | initEReference(getAggregateExpression_Relation(), this.getRelation(), null, "relation", null, 0, 1, AggregateExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); |
2489 | initEReference(getAggregateExpression_ParameterSubstitution(), this.getAggregatedParameterSubstitution(), null, "parameterSubstitution", null, 0, -1, AggregateExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
2490 | initEReference(getAggregateExpression_ResultVariable(), this.getVariable(), null, "resultVariable", null, 0, 1, AggregateExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
2436 | 2491 | ||
2437 | initEClass(sumEClass, Sum.class, "Sum", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | 2492 | initEClass(sumEClass, Sum.class, "Sum", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
2438 | 2493 | ||
@@ -2445,6 +2500,9 @@ public class LogiclanguagePackageImpl extends EPackageImpl implements Logiclangu | |||
2445 | initEClass(projectedAggregateExpressionEClass, ProjectedAggregateExpression.class, "ProjectedAggregateExpression", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | 2500 | initEClass(projectedAggregateExpressionEClass, ProjectedAggregateExpression.class, "ProjectedAggregateExpression", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
2446 | initEAttribute(getProjectedAggregateExpression_ProjectionIndex(), ecorePackage.getEInt(), "projectionIndex", "-1", 1, 1, ProjectedAggregateExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | 2501 | initEAttribute(getProjectedAggregateExpression_ProjectionIndex(), ecorePackage.getEInt(), "projectionIndex", "-1", 1, 1, ProjectedAggregateExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); |
2447 | 2502 | ||
2503 | initEClass(aggregatedParameterSubstitutionEClass, AggregatedParameterSubstitution.class, "AggregatedParameterSubstitution", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | ||
2504 | initEReference(getAggregatedParameterSubstitution_Variable(), this.getVariable(), null, "variable", null, 0, 1, AggregatedParameterSubstitution.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | ||
2505 | |||
2448 | // Create resource | 2506 | // Create resource |
2449 | createResource(eNS_URI); | 2507 | createResource(eNS_URI); |
2450 | } | 2508 | } |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/util/LogiclanguageAdapterFactory.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/util/LogiclanguageAdapterFactory.java index 25edee70..3fc7c298 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/util/LogiclanguageAdapterFactory.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/util/LogiclanguageAdapterFactory.java | |||
@@ -328,6 +328,10 @@ public class LogiclanguageAdapterFactory extends AdapterFactoryImpl { | |||
328 | return createProjectedAggregateExpressionAdapter(); | 328 | return createProjectedAggregateExpressionAdapter(); |
329 | } | 329 | } |
330 | @Override | 330 | @Override |
331 | public Adapter caseAggregatedParameterSubstitution(AggregatedParameterSubstitution object) { | ||
332 | return createAggregatedParameterSubstitutionAdapter(); | ||
333 | } | ||
334 | @Override | ||
331 | public Adapter defaultCase(EObject object) { | 335 | public Adapter defaultCase(EObject object) { |
332 | return createEObjectAdapter(); | 336 | return createEObjectAdapter(); |
333 | } | 337 | } |
@@ -1258,6 +1262,20 @@ public class LogiclanguageAdapterFactory extends AdapterFactoryImpl { | |||
1258 | } | 1262 | } |
1259 | 1263 | ||
1260 | /** | 1264 | /** |
1265 | * Creates a new adapter for an object of class '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution <em>Aggregated Parameter Substitution</em>}'. | ||
1266 | * <!-- begin-user-doc --> | ||
1267 | * This default implementation returns null so that we can easily ignore cases; | ||
1268 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
1269 | * <!-- end-user-doc --> | ||
1270 | * @return the new adapter. | ||
1271 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregatedParameterSubstitution | ||
1272 | * @generated | ||
1273 | */ | ||
1274 | public Adapter createAggregatedParameterSubstitutionAdapter() { | ||
1275 | return null; | ||
1276 | } | ||
1277 | |||
1278 | /** | ||
1261 | * Creates a new adapter for the default case. | 1279 | * Creates a new adapter for the default case. |
1262 | * <!-- begin-user-doc --> | 1280 | * <!-- begin-user-doc --> |
1263 | * This default implementation returns null. | 1281 | * This default implementation returns null. |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/util/LogiclanguageSwitch.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/util/LogiclanguageSwitch.java index fc443484..ac821567 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/util/LogiclanguageSwitch.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/util/LogiclanguageSwitch.java | |||
@@ -617,6 +617,12 @@ public class LogiclanguageSwitch<T> extends Switch<T> { | |||
617 | if (result == null) result = defaultCase(theEObject); | 617 | if (result == null) result = defaultCase(theEObject); |
618 | return result; | 618 | return result; |
619 | } | 619 | } |
620 | case LogiclanguagePackage.AGGREGATED_PARAMETER_SUBSTITUTION: { | ||
621 | AggregatedParameterSubstitution aggregatedParameterSubstitution = (AggregatedParameterSubstitution)theEObject; | ||
622 | T result = caseAggregatedParameterSubstitution(aggregatedParameterSubstitution); | ||
623 | if (result == null) result = defaultCase(theEObject); | ||
624 | return result; | ||
625 | } | ||
620 | default: return defaultCase(theEObject); | 626 | default: return defaultCase(theEObject); |
621 | } | 627 | } |
622 | } | 628 | } |
@@ -1597,6 +1603,21 @@ public class LogiclanguageSwitch<T> extends Switch<T> { | |||
1597 | } | 1603 | } |
1598 | 1604 | ||
1599 | /** | 1605 | /** |
1606 | * Returns the result of interpreting the object as an instance of '<em>Aggregated Parameter Substitution</em>'. | ||
1607 | * <!-- begin-user-doc --> | ||
1608 | * This implementation returns null; | ||
1609 | * returning a non-null result will terminate the switch. | ||
1610 | * <!-- end-user-doc --> | ||
1611 | * @param object the target of the switch. | ||
1612 | * @return the result of interpreting the object as an instance of '<em>Aggregated Parameter Substitution</em>'. | ||
1613 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
1614 | * @generated | ||
1615 | */ | ||
1616 | public T caseAggregatedParameterSubstitution(AggregatedParameterSubstitution object) { | ||
1617 | return null; | ||
1618 | } | ||
1619 | |||
1620 | /** | ||
1600 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. | 1621 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
1601 | * <!-- begin-user-doc --> | 1622 | * <!-- begin-user-doc --> |
1602 | * This implementation returns null; | 1623 | * This implementation returns null; |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.aird b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.aird index 5673d66a..e96b4586 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.aird +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.aird | |||
@@ -7805,7 +7805,7 @@ | |||
7805 | <styles xmi:type="notation:FilteringStyle" xmi:id="_rsImpm6WEemSyfDlsGAqLA"/> | 7805 | <styles xmi:type="notation:FilteringStyle" xmi:id="_rsImpm6WEemSyfDlsGAqLA"/> |
7806 | </children> | 7806 | </children> |
7807 | <styles xmi:type="notation:ShapeStyle" xmi:id="_rsImoW6WEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> | 7807 | <styles xmi:type="notation:ShapeStyle" xmi:id="_rsImoW6WEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> |
7808 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_rsImom6WEemSyfDlsGAqLA" x="2085" y="363" width="135" height="40"/> | 7808 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_rsImom6WEemSyfDlsGAqLA" x="2280" y="365" width="135" height="40"/> |
7809 | </children> | 7809 | </children> |
7810 | <children xmi:type="notation:Node" xmi:id="_31nEcG6XEemSyfDlsGAqLA" type="2003" element="_309kMG6XEemSyfDlsGAqLA"> | 7810 | <children xmi:type="notation:Node" xmi:id="_31nEcG6XEemSyfDlsGAqLA" type="2003" element="_309kMG6XEemSyfDlsGAqLA"> |
7811 | <children xmi:type="notation:Node" xmi:id="_31nrgG6XEemSyfDlsGAqLA" type="5007"/> | 7811 | <children xmi:type="notation:Node" xmi:id="_31nrgG6XEemSyfDlsGAqLA" type="5007"/> |
@@ -7814,7 +7814,7 @@ | |||
7814 | <styles xmi:type="notation:FilteringStyle" xmi:id="_31nrg26XEemSyfDlsGAqLA"/> | 7814 | <styles xmi:type="notation:FilteringStyle" xmi:id="_31nrg26XEemSyfDlsGAqLA"/> |
7815 | </children> | 7815 | </children> |
7816 | <styles xmi:type="notation:ShapeStyle" xmi:id="_31nEcW6XEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> | 7816 | <styles xmi:type="notation:ShapeStyle" xmi:id="_31nEcW6XEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> |
7817 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_31nEcm6XEemSyfDlsGAqLA" x="2196" y="564" width="60" height="41"/> | 7817 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_31nEcm6XEemSyfDlsGAqLA" x="2391" y="566" width="60" height="41"/> |
7818 | </children> | 7818 | </children> |
7819 | <children xmi:type="notation:Node" xmi:id="_53F0AG6XEemSyfDlsGAqLA" type="2003" element="_52k2oG6XEemSyfDlsGAqLA"> | 7819 | <children xmi:type="notation:Node" xmi:id="_53F0AG6XEemSyfDlsGAqLA" type="2003" element="_52k2oG6XEemSyfDlsGAqLA"> |
7820 | <children xmi:type="notation:Node" xmi:id="_53F0A26XEemSyfDlsGAqLA" type="5007"/> | 7820 | <children xmi:type="notation:Node" xmi:id="_53F0A26XEemSyfDlsGAqLA" type="5007"/> |
@@ -7823,7 +7823,7 @@ | |||
7823 | <styles xmi:type="notation:FilteringStyle" xmi:id="_53F0Bm6XEemSyfDlsGAqLA"/> | 7823 | <styles xmi:type="notation:FilteringStyle" xmi:id="_53F0Bm6XEemSyfDlsGAqLA"/> |
7824 | </children> | 7824 | </children> |
7825 | <styles xmi:type="notation:ShapeStyle" xmi:id="_53F0AW6XEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> | 7825 | <styles xmi:type="notation:ShapeStyle" xmi:id="_53F0AW6XEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> |
7826 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_53F0Am6XEemSyfDlsGAqLA" x="2115" y="466" width="75" height="28"/> | 7826 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_53F0Am6XEemSyfDlsGAqLA" x="2310" y="468" width="75" height="28"/> |
7827 | </children> | 7827 | </children> |
7828 | <children xmi:type="notation:Node" xmi:id="_8nYKUG6XEemSyfDlsGAqLA" type="2003" element="_8mxtYG6XEemSyfDlsGAqLA"> | 7828 | <children xmi:type="notation:Node" xmi:id="_8nYKUG6XEemSyfDlsGAqLA" type="2003" element="_8mxtYG6XEemSyfDlsGAqLA"> |
7829 | <children xmi:type="notation:Node" xmi:id="_8nYxYG6XEemSyfDlsGAqLA" type="5007"/> | 7829 | <children xmi:type="notation:Node" xmi:id="_8nYxYG6XEemSyfDlsGAqLA" type="5007"/> |
@@ -7832,7 +7832,7 @@ | |||
7832 | <styles xmi:type="notation:FilteringStyle" xmi:id="_8nYxY26XEemSyfDlsGAqLA"/> | 7832 | <styles xmi:type="notation:FilteringStyle" xmi:id="_8nYxY26XEemSyfDlsGAqLA"/> |
7833 | </children> | 7833 | </children> |
7834 | <styles xmi:type="notation:ShapeStyle" xmi:id="_8nYKUW6XEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> | 7834 | <styles xmi:type="notation:ShapeStyle" xmi:id="_8nYKUW6XEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> |
7835 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_8nYKUm6XEemSyfDlsGAqLA" x="2268" y="564" width="63" height="16"/> | 7835 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_8nYKUm6XEemSyfDlsGAqLA" x="2463" y="566" width="63" height="16"/> |
7836 | </children> | 7836 | </children> |
7837 | <children xmi:type="notation:Node" xmi:id="_-vo3UG6XEemSyfDlsGAqLA" type="2003" element="_-vAlMG6XEemSyfDlsGAqLA"> | 7837 | <children xmi:type="notation:Node" xmi:id="_-vo3UG6XEemSyfDlsGAqLA" type="2003" element="_-vAlMG6XEemSyfDlsGAqLA"> |
7838 | <children xmi:type="notation:Node" xmi:id="_-vpeYG6XEemSyfDlsGAqLA" type="5007"/> | 7838 | <children xmi:type="notation:Node" xmi:id="_-vpeYG6XEemSyfDlsGAqLA" type="5007"/> |
@@ -7841,7 +7841,7 @@ | |||
7841 | <styles xmi:type="notation:FilteringStyle" xmi:id="_-vpeY26XEemSyfDlsGAqLA"/> | 7841 | <styles xmi:type="notation:FilteringStyle" xmi:id="_-vpeY26XEemSyfDlsGAqLA"/> |
7842 | </children> | 7842 | </children> |
7843 | <styles xmi:type="notation:ShapeStyle" xmi:id="_-vo3UW6XEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> | 7843 | <styles xmi:type="notation:ShapeStyle" xmi:id="_-vo3UW6XEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> |
7844 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_-vo3Um6XEemSyfDlsGAqLA" x="2340" y="564" width="60" height="16"/> | 7844 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_-vo3Um6XEemSyfDlsGAqLA" x="2535" y="566" width="60" height="16"/> |
7845 | </children> | 7845 | </children> |
7846 | <children xmi:type="notation:Node" xmi:id="_9KcB0G6cEemSyfDlsGAqLA" type="2003" element="_9J4BIG6cEemSyfDlsGAqLA"> | 7846 | <children xmi:type="notation:Node" xmi:id="_9KcB0G6cEemSyfDlsGAqLA" type="2003" element="_9J4BIG6cEemSyfDlsGAqLA"> |
7847 | <children xmi:type="notation:Node" xmi:id="_9KcB026cEemSyfDlsGAqLA" type="5007"/> | 7847 | <children xmi:type="notation:Node" xmi:id="_9KcB026cEemSyfDlsGAqLA" type="5007"/> |
@@ -7854,7 +7854,16 @@ | |||
7854 | <styles xmi:type="notation:FilteringStyle" xmi:id="_9KcB1m6cEemSyfDlsGAqLA"/> | 7854 | <styles xmi:type="notation:FilteringStyle" xmi:id="_9KcB1m6cEemSyfDlsGAqLA"/> |
7855 | </children> | 7855 | </children> |
7856 | <styles xmi:type="notation:ShapeStyle" xmi:id="_9KcB0W6cEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> | 7856 | <styles xmi:type="notation:ShapeStyle" xmi:id="_9KcB0W6cEemSyfDlsGAqLA" fontName="Segoe UI" fontHeight="8"/> |
7857 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_9KcB0m6cEemSyfDlsGAqLA" x="2196" y="466" width="183" height="53"/> | 7857 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_9KcB0m6cEemSyfDlsGAqLA" x="2391" y="468" width="183" height="53"/> |
7858 | </children> | ||
7859 | <children xmi:type="notation:Node" xmi:id="_qmVssKJeEemXzuA5M0BZIw" type="2003" element="_qkRQIKJeEemXzuA5M0BZIw"> | ||
7860 | <children xmi:type="notation:Node" xmi:id="_qmh58KJeEemXzuA5M0BZIw" type="5007"/> | ||
7861 | <children xmi:type="notation:Node" xmi:id="_qmihAKJeEemXzuA5M0BZIw" type="7004"> | ||
7862 | <styles xmi:type="notation:SortingStyle" xmi:id="_qmihAaJeEemXzuA5M0BZIw"/> | ||
7863 | <styles xmi:type="notation:FilteringStyle" xmi:id="_qmihAqJeEemXzuA5M0BZIw"/> | ||
7864 | </children> | ||
7865 | <styles xmi:type="notation:ShapeStyle" xmi:id="_qmVssaJeEemXzuA5M0BZIw" fontName="Segoe UI" fontHeight="8"/> | ||
7866 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qmVssqJeEemXzuA5M0BZIw" x="2028" y="367" width="219" height="41"/> | ||
7858 | </children> | 7867 | </children> |
7859 | <styles xmi:type="notation:DiagramStyle" xmi:id="_l6X5OrdnEeau1vMV3Bsx4w"/> | 7868 | <styles xmi:type="notation:DiagramStyle" xmi:id="_l6X5OrdnEeau1vMV3Bsx4w"/> |
7860 | <edges xmi:type="notation:Edge" xmi:id="_l6X5a7dnEeau1vMV3Bsx4w" type="4001" element="_l6Zt6bdnEeau1vMV3Bsx4w" source="_l6XR7LdnEeau1vMV3Bsx4w" target="_l6XR27dnEeau1vMV3Bsx4w"> | 7869 | <edges xmi:type="notation:Edge" xmi:id="_l6X5a7dnEeau1vMV3Bsx4w" type="4001" element="_l6Zt6bdnEeau1vMV3Bsx4w" source="_l6XR7LdnEeau1vMV3Bsx4w" target="_l6XR27dnEeau1vMV3Bsx4w"> |
@@ -9011,17 +9020,17 @@ | |||
9011 | </edges> | 9020 | </edges> |
9012 | <edges xmi:type="notation:Edge" xmi:id="_hKdI4G6cEemSyfDlsGAqLA" type="4001" element="_hJ8ymW6cEemSyfDlsGAqLA" source="_rsImoG6WEemSyfDlsGAqLA" target="_hTMLdIKhEeeAppuRs-roLg"> | 9021 | <edges xmi:type="notation:Edge" xmi:id="_hKdI4G6cEemSyfDlsGAqLA" type="4001" element="_hJ8ymW6cEemSyfDlsGAqLA" source="_rsImoG6WEemSyfDlsGAqLA" target="_hTMLdIKhEeeAppuRs-roLg"> |
9013 | <children xmi:type="notation:Node" xmi:id="_hKdv8G6cEemSyfDlsGAqLA" type="6001"> | 9022 | <children xmi:type="notation:Node" xmi:id="_hKdv8G6cEemSyfDlsGAqLA" type="6001"> |
9014 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKdv8W6cEemSyfDlsGAqLA" x="143" y="-10"/> | 9023 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKdv8W6cEemSyfDlsGAqLA" x="239" y="-10"/> |
9015 | </children> | 9024 | </children> |
9016 | <children xmi:type="notation:Node" xmi:id="_hKdv8m6cEemSyfDlsGAqLA" type="6002"> | 9025 | <children xmi:type="notation:Node" xmi:id="_hKdv8m6cEemSyfDlsGAqLA" type="6002"> |
9017 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKdv826cEemSyfDlsGAqLA" x="27"/> | 9026 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKdv826cEemSyfDlsGAqLA" x="-4"/> |
9018 | </children> | 9027 | </children> |
9019 | <children xmi:type="notation:Node" xmi:id="_hKdv9G6cEemSyfDlsGAqLA" type="6003"> | 9028 | <children xmi:type="notation:Node" xmi:id="_hKdv9G6cEemSyfDlsGAqLA" type="6003"> |
9020 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKdv9W6cEemSyfDlsGAqLA" x="136" y="5"/> | 9029 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKdv9W6cEemSyfDlsGAqLA" x="165" y="5"/> |
9021 | </children> | 9030 | </children> |
9022 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_hKdI4W6cEemSyfDlsGAqLA" routing="Rectilinear"/> | 9031 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_hKdI4W6cEemSyfDlsGAqLA" routing="Rectilinear"/> |
9023 | <styles xmi:type="notation:FontStyle" xmi:id="_hKdI4m6cEemSyfDlsGAqLA" fontColor="7490599" fontName="Segoe UI" fontHeight="8"/> | 9032 | <styles xmi:type="notation:FontStyle" xmi:id="_hKdI4m6cEemSyfDlsGAqLA" fontColor="7490599" fontName="Segoe UI" fontHeight="8"/> |
9024 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hKdI426cEemSyfDlsGAqLA" points="[15, 30, 720, -126]$[15, 228, 720, 72]$[-765, 228, -60, 72]$[-765, 204, -60, 48]"/> | 9033 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hKdI426cEemSyfDlsGAqLA" points="[15, 30, 915, -124]$[15, 226, 915, 72]$[-960, 226, -60, 72]$[-960, 202, -60, 48]"/> |
9025 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hKdv9m6cEemSyfDlsGAqLA" id="(0.0,0.23076923076923078)"/> | 9034 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hKdv9m6cEemSyfDlsGAqLA" id="(0.0,0.23076923076923078)"/> |
9026 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hKdv926cEemSyfDlsGAqLA" id="(0.6990291262135923,0.0)"/> | 9035 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hKdv926cEemSyfDlsGAqLA" id="(0.6990291262135923,0.0)"/> |
9027 | </edges> | 9036 | </edges> |
@@ -9105,6 +9114,54 @@ | |||
9105 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PSa65G6dEemSyfDlsGAqLA" id="(1.0172413793103448,0.0)"/> | 9114 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PSa65G6dEemSyfDlsGAqLA" id="(1.0172413793103448,0.0)"/> |
9106 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PSa65W6dEemSyfDlsGAqLA" id="(0.5,0.38235294117647056)"/> | 9115 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_PSa65W6dEemSyfDlsGAqLA" id="(0.5,0.38235294117647056)"/> |
9107 | </edges> | 9116 | </edges> |
9117 | <edges xmi:type="notation:Edge" xmi:id="_uJz-AKJfEemXzuA5M0BZIw" type="4001" element="_uI5YDKJfEemXzuA5M0BZIw" source="_rsImoG6WEemSyfDlsGAqLA" target="_qmVssKJeEemXzuA5M0BZIw"> | ||
9118 | <children xmi:type="notation:Node" xmi:id="_uJ1zMKJfEemXzuA5M0BZIw" type="6001"> | ||
9119 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_uJ1zMaJfEemXzuA5M0BZIw" x="4" y="32"/> | ||
9120 | </children> | ||
9121 | <children xmi:type="notation:Node" xmi:id="_uJ3BUKJfEemXzuA5M0BZIw" type="6002"> | ||
9122 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_uJ3BUaJfEemXzuA5M0BZIw" x="7"/> | ||
9123 | </children> | ||
9124 | <children xmi:type="notation:Node" xmi:id="_uJ3oYKJfEemXzuA5M0BZIw" type="6003"> | ||
9125 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_uJ3oYaJfEemXzuA5M0BZIw" x="-2"/> | ||
9126 | </children> | ||
9127 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_uJz-AaJfEemXzuA5M0BZIw" routing="Rectilinear"/> | ||
9128 | <styles xmi:type="notation:FontStyle" xmi:id="_uJz-AqJfEemXzuA5M0BZIw" fontColor="7490599" fontName="Segoe UI" fontHeight="8"/> | ||
9129 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_uJz-A6JfEemXzuA5M0BZIw" points="[-133, 2, 252, -3]$[-168, 2, 217, -3]"/> | ||
9130 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_uJ6rsKJfEemXzuA5M0BZIw" id="(1.0,0.48717948717948717)"/> | ||
9131 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_uJ6rsaJfEemXzuA5M0BZIw" id="(0.0,0.5641025641025641)"/> | ||
9132 | </edges> | ||
9133 | <edges xmi:type="notation:Edge" xmi:id="__oNHgKJfEemXzuA5M0BZIw" type="4001" element="__nLz2aJfEemXzuA5M0BZIw" source="_qmVssKJeEemXzuA5M0BZIw" target="_l6XSGLdnEeau1vMV3Bsx4w"> | ||
9134 | <children xmi:type="notation:Node" xmi:id="__oNukKJfEemXzuA5M0BZIw" type="6001"> | ||
9135 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="__oNukaJfEemXzuA5M0BZIw" y="-10"/> | ||
9136 | </children> | ||
9137 | <children xmi:type="notation:Node" xmi:id="__oNukqJfEemXzuA5M0BZIw" type="6002"> | ||
9138 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="__oNuk6JfEemXzuA5M0BZIw" y="10"/> | ||
9139 | </children> | ||
9140 | <children xmi:type="notation:Node" xmi:id="__oNulKJfEemXzuA5M0BZIw" type="6003"> | ||
9141 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="__oNulaJfEemXzuA5M0BZIw" y="10"/> | ||
9142 | </children> | ||
9143 | <styles xmi:type="notation:ConnectorStyle" xmi:id="__oNHgaJfEemXzuA5M0BZIw" routing="Rectilinear"/> | ||
9144 | <styles xmi:type="notation:FontStyle" xmi:id="__oNHgqJfEemXzuA5M0BZIw" fontColor="7490599" fontName="Segoe UI" fontHeight="8"/> | ||
9145 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="__oNHg6JfEemXzuA5M0BZIw" points="[0, 0, 86, -62]$[0, 62, 86, 0]$[-86, 62, 0, 0]"/> | ||
9146 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="__oOVoKJfEemXzuA5M0BZIw" id="(0.6082949308755761,1.0)"/> | ||
9147 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="__oOVoaJfEemXzuA5M0BZIw" id="(1.0,0.3076923076923077)"/> | ||
9148 | </edges> | ||
9149 | <edges xmi:type="notation:Edge" xmi:id="_QZPVkKJ9EemXzuA5M0BZIw" type="4001" element="_QYZBAKJ9EemXzuA5M0BZIw" source="_rsImoG6WEemSyfDlsGAqLA" target="_l6XSGLdnEeau1vMV3Bsx4w"> | ||
9150 | <children xmi:type="notation:Node" xmi:id="_QZP8oKJ9EemXzuA5M0BZIw" type="6001"> | ||
9151 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_QZP8oaJ9EemXzuA5M0BZIw" x="-12" y="-10"/> | ||
9152 | </children> | ||
9153 | <children xmi:type="notation:Node" xmi:id="_QZP8oqJ9EemXzuA5M0BZIw" type="6002"> | ||
9154 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_QZP8o6J9EemXzuA5M0BZIw" x="4" y="10"/> | ||
9155 | </children> | ||
9156 | <children xmi:type="notation:Node" xmi:id="_QZQjsKJ9EemXzuA5M0BZIw" type="6003"> | ||
9157 | <layoutConstraint xmi:type="notation:Bounds" xmi:id="_QZQjsaJ9EemXzuA5M0BZIw" x="-4" y="10"/> | ||
9158 | </children> | ||
9159 | <styles xmi:type="notation:ConnectorStyle" xmi:id="_QZPVkaJ9EemXzuA5M0BZIw" routing="Rectilinear"/> | ||
9160 | <styles xmi:type="notation:FontStyle" xmi:id="_QZPVkqJ9EemXzuA5M0BZIw" fontColor="7490599" fontName="Segoe UI" fontHeight="8"/> | ||
9161 | <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_QZPVk6J9EemXzuA5M0BZIw" points="[-36, 0, 206, -76]$[-36, 89, 206, 13]$[-242, 89, 0, 13]"/> | ||
9162 | <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_QZQjsqJ9EemXzuA5M0BZIw" id="(0.2706766917293233,1.0)"/> | ||
9163 | <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_QZQjs6J9EemXzuA5M0BZIw" id="(1.0,0.6153846153846154)"/> | ||
9164 | </edges> | ||
9108 | </data> | 9165 | </data> |
9109 | </ownedAnnotationEntries> | 9166 | </ownedAnnotationEntries> |
9110 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_l6ZIGbdnEeau1vMV3Bsx4w" name="Term" tooltipText="" outgoingEdges="_l6ZufbdnEeau1vMV3Bsx4w" incomingEdges="_l6Zt6bdnEeau1vMV3Bsx4w _l6Zt9bdnEeau1vMV3Bsx4w _l6Zt-bdnEeau1vMV3Bsx4w _l6Zt_bdnEeau1vMV3Bsx4w _l6ZuAbdnEeau1vMV3Bsx4w _l6ZuBbdnEeau1vMV3Bsx4w _l6ZuCbdnEeau1vMV3Bsx4w _l6ZuDbdnEeau1vMV3Bsx4w _l6ZuEbdnEeau1vMV3Bsx4w _l6ZuFbdnEeau1vMV3Bsx4w _l6ZuGbdnEeau1vMV3Bsx4w _l6ZuHbdnEeau1vMV3Bsx4w _l6ZuIbdnEeau1vMV3Bsx4w _l6ZuJbdnEeau1vMV3Bsx4w _l6ZuKbdnEeau1vMV3Bsx4w _l6ZuLbdnEeau1vMV3Bsx4w _l6ZuMbdnEeau1vMV3Bsx4w _l6ZuNbdnEeau1vMV3Bsx4w _l6ZuObdnEeau1vMV3Bsx4w _l6ZuPbdnEeau1vMV3Bsx4w _l6ZuQbdnEeau1vMV3Bsx4w _l6ZuRbdnEeau1vMV3Bsx4w _l6ZuhbdnEeau1vMV3Bsx4w _l6ZuibdnEeau1vMV3Bsx4w _l6ZunbdnEeau1vMV3Bsx4w _l6ZuqbdnEeau1vMV3Bsx4w _l6ZuwbdnEeau1vMV3Bsx4w _l6Zu3bdnEeau1vMV3Bsx4w _l6ZvHbdnEeau1vMV3Bsx4w _l6ZvIbdnEeau1vMV3Bsx4w _l6ZvJbdnEeau1vMV3Bsx4w _l6ZvKbdnEeau1vMV3Bsx4w _l6ZvZ7dnEeau1vMV3Bsx4w _kQZhsLd1Eeau1vMV3Bsx4w _BoaVwLqxEeau1vMV3Bsx4w _Vi5psIKgEeeAppuRs-roLg _YRIxkIKgEeeAppuRs-roLg _sGSk0IKlEeeAppuRs-roLg _za0wsm6WEemSyfDlsGAqLA" width="12" height="10"> | 9167 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_l6ZIGbdnEeau1vMV3Bsx4w" name="Term" tooltipText="" outgoingEdges="_l6ZufbdnEeau1vMV3Bsx4w" incomingEdges="_l6Zt6bdnEeau1vMV3Bsx4w _l6Zt9bdnEeau1vMV3Bsx4w _l6Zt-bdnEeau1vMV3Bsx4w _l6Zt_bdnEeau1vMV3Bsx4w _l6ZuAbdnEeau1vMV3Bsx4w _l6ZuBbdnEeau1vMV3Bsx4w _l6ZuCbdnEeau1vMV3Bsx4w _l6ZuDbdnEeau1vMV3Bsx4w _l6ZuEbdnEeau1vMV3Bsx4w _l6ZuFbdnEeau1vMV3Bsx4w _l6ZuGbdnEeau1vMV3Bsx4w _l6ZuHbdnEeau1vMV3Bsx4w _l6ZuIbdnEeau1vMV3Bsx4w _l6ZuJbdnEeau1vMV3Bsx4w _l6ZuKbdnEeau1vMV3Bsx4w _l6ZuLbdnEeau1vMV3Bsx4w _l6ZuMbdnEeau1vMV3Bsx4w _l6ZuNbdnEeau1vMV3Bsx4w _l6ZuObdnEeau1vMV3Bsx4w _l6ZuPbdnEeau1vMV3Bsx4w _l6ZuQbdnEeau1vMV3Bsx4w _l6ZuRbdnEeau1vMV3Bsx4w _l6ZuhbdnEeau1vMV3Bsx4w _l6ZuibdnEeau1vMV3Bsx4w _l6ZunbdnEeau1vMV3Bsx4w _l6ZuqbdnEeau1vMV3Bsx4w _l6ZuwbdnEeau1vMV3Bsx4w _l6Zu3bdnEeau1vMV3Bsx4w _l6ZvHbdnEeau1vMV3Bsx4w _l6ZvIbdnEeau1vMV3Bsx4w _l6ZvJbdnEeau1vMV3Bsx4w _l6ZvKbdnEeau1vMV3Bsx4w _l6ZvZ7dnEeau1vMV3Bsx4w _kQZhsLd1Eeau1vMV3Bsx4w _BoaVwLqxEeau1vMV3Bsx4w _Vi5psIKgEeeAppuRs-roLg _YRIxkIKgEeeAppuRs-roLg _sGSk0IKlEeeAppuRs-roLg _za0wsm6WEemSyfDlsGAqLA" width="12" height="10"> |
@@ -9199,7 +9256,7 @@ | |||
9199 | <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> | 9256 | <actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/> |
9200 | </ownedElements> | 9257 | </ownedElements> |
9201 | </ownedDiagramElements> | 9258 | </ownedDiagramElements> |
9202 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_l6ZIL7dnEeau1vMV3Bsx4w" name="Variable" tooltipText="" outgoingEdges="_JfkfULd8Eeau1vMV3Bsx4w _e1jg0IKgEeeAppuRs-roLg" incomingEdges="_l6Zt8bdnEeau1vMV3Bsx4w" width="12" height="10"> | 9259 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_l6ZIL7dnEeau1vMV3Bsx4w" name="Variable" tooltipText="" outgoingEdges="_JfkfULd8Eeau1vMV3Bsx4w _e1jg0IKgEeeAppuRs-roLg" incomingEdges="_l6Zt8bdnEeau1vMV3Bsx4w __nLz2aJfEemXzuA5M0BZIw _QYZBAKJ9EemXzuA5M0BZIw" width="12" height="10"> |
9203 | <target xmi:type="ecore:EClass" href="logiclanguage.ecore#//Variable"/> | 9260 | <target xmi:type="ecore:EClass" href="logiclanguage.ecore#//Variable"/> |
9204 | <semanticElements xmi:type="ecore:EClass" href="logiclanguage.ecore#//Variable"/> | 9261 | <semanticElements xmi:type="ecore:EClass" href="logiclanguage.ecore#//Variable"/> |
9205 | <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> | 9262 | <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> |
@@ -10473,7 +10530,7 @@ | |||
10473 | </ownedStyle> | 10530 | </ownedStyle> |
10474 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/> | 10531 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/> |
10475 | </ownedDiagramElements> | 10532 | </ownedDiagramElements> |
10476 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_rrY_wG6WEemSyfDlsGAqLA" name="AggregateExpression" tooltipText="" outgoingEdges="_za0wsm6WEemSyfDlsGAqLA _hJ8ymW6cEemSyfDlsGAqLA" incomingEdges="_wovb6G6cEemSyfDlsGAqLA _OKfpkm6dEemSyfDlsGAqLA" width="12" height="10"> | 10533 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_rrY_wG6WEemSyfDlsGAqLA" name="AggregateExpression" tooltipText="" outgoingEdges="_za0wsm6WEemSyfDlsGAqLA _hJ8ymW6cEemSyfDlsGAqLA _uI5YDKJfEemXzuA5M0BZIw _QYZBAKJ9EemXzuA5M0BZIw" incomingEdges="_wovb6G6cEemSyfDlsGAqLA _OKfpkm6dEemSyfDlsGAqLA" width="12" height="10"> |
10477 | <target xmi:type="ecore:EClass" href="logiclanguage.ecore#//AggregateExpression"/> | 10534 | <target xmi:type="ecore:EClass" href="logiclanguage.ecore#//AggregateExpression"/> |
10478 | <semanticElements xmi:type="ecore:EClass" href="logiclanguage.ecore#//AggregateExpression"/> | 10535 | <semanticElements xmi:type="ecore:EClass" href="logiclanguage.ecore#//AggregateExpression"/> |
10479 | <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> | 10536 | <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> |
@@ -10635,6 +10692,58 @@ | |||
10635 | </ownedStyle> | 10692 | </ownedStyle> |
10636 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/> | 10693 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/> |
10637 | </ownedDiagramElements> | 10694 | </ownedDiagramElements> |
10695 | <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_qkRQIKJeEemXzuA5M0BZIw" name="AggregatedParameterSubstitution" tooltipText="" outgoingEdges="__nLz2aJfEemXzuA5M0BZIw" incomingEdges="_uI5YDKJfEemXzuA5M0BZIw" width="12" height="10"> | ||
10696 | <target xmi:type="ecore:EClass" href="logiclanguage.ecore#//AggregatedParameterSubstitution"/> | ||
10697 | <semanticElements xmi:type="ecore:EClass" href="logiclanguage.ecore#//AggregatedParameterSubstitution"/> | ||
10698 | <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> | ||
10699 | <arrangeConstraints>KEEP_SIZE</arrangeConstraints> | ||
10700 | <arrangeConstraints>KEEP_RATIO</arrangeConstraints> | ||
10701 | <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_qkTFUKJeEemXzuA5M0BZIw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> | ||
10702 | <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/> | ||
10703 | </ownedStyle> | ||
10704 | <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/> | ||
10705 | </ownedDiagramElements> | ||
10706 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_uI5YDKJfEemXzuA5M0BZIw" name="[0..*] parameterSubstitution" sourceNode="_rrY_wG6WEemSyfDlsGAqLA" targetNode="_qkRQIKJeEemXzuA5M0BZIw"> | ||
10707 | <target xmi:type="ecore:EReference" href="logiclanguage.ecore#//AggregateExpression/parameterSubstitution"/> | ||
10708 | <semanticElements xmi:type="ecore:EReference" href="logiclanguage.ecore#//AggregateExpression/parameterSubstitution"/> | ||
10709 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_uI6mIKJfEemXzuA5M0BZIw" description="_l6XRhLdnEeau1vMV3Bsx4w" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0"> | ||
10710 | <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_uI6mIqJfEemXzuA5M0BZIw" showIcon="false"> | ||
10711 | <customFeatures>labelSize</customFeatures> | ||
10712 | </centerLabelStyle> | ||
10713 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_uI6mIaJfEemXzuA5M0BZIw" showIcon="false" labelColor="39,76,114"> | ||
10714 | <customFeatures>labelSize</customFeatures> | ||
10715 | </endLabelStyle> | ||
10716 | </ownedStyle> | ||
10717 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/> | ||
10718 | </ownedDiagramElements> | ||
10719 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="__nLz2aJfEemXzuA5M0BZIw" name="[0..1] variable" sourceNode="_qkRQIKJeEemXzuA5M0BZIw" targetNode="_l6ZIL7dnEeau1vMV3Bsx4w"> | ||
10720 | <target xmi:type="ecore:EReference" href="logiclanguage.ecore#//AggregatedParameterSubstitution/variable"/> | ||
10721 | <semanticElements xmi:type="ecore:EReference" href="logiclanguage.ecore#//AggregatedParameterSubstitution/variable"/> | ||
10722 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="__nNB8KJfEemXzuA5M0BZIw" routingStyle="manhattan" strokeColor="0,0,0"> | ||
10723 | <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']/@style"/> | ||
10724 | <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="__nNB8qJfEemXzuA5M0BZIw" showIcon="false"> | ||
10725 | <customFeatures>labelSize</customFeatures> | ||
10726 | </centerLabelStyle> | ||
10727 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="__nNB8aJfEemXzuA5M0BZIw" showIcon="false" labelColor="39,76,114"> | ||
10728 | <customFeatures>labelSize</customFeatures> | ||
10729 | </endLabelStyle> | ||
10730 | </ownedStyle> | ||
10731 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/> | ||
10732 | </ownedDiagramElements> | ||
10733 | <ownedDiagramElements xmi:type="diagram:DEdge" uid="_QYZBAKJ9EemXzuA5M0BZIw" name="[0..1] resultVariable" sourceNode="_rrY_wG6WEemSyfDlsGAqLA" targetNode="_l6ZIL7dnEeau1vMV3Bsx4w"> | ||
10734 | <target xmi:type="ecore:EReference" href="logiclanguage.ecore#//AggregateExpression/resultVariable"/> | ||
10735 | <semanticElements xmi:type="ecore:EReference" href="logiclanguage.ecore#//AggregateExpression/resultVariable"/> | ||
10736 | <ownedStyle xmi:type="diagram:EdgeStyle" uid="_QYZBAaJ9EemXzuA5M0BZIw" routingStyle="manhattan" strokeColor="0,0,0"> | ||
10737 | <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']/@style"/> | ||
10738 | <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_QYZBA6J9EemXzuA5M0BZIw" showIcon="false"> | ||
10739 | <customFeatures>labelSize</customFeatures> | ||
10740 | </centerLabelStyle> | ||
10741 | <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_QYZBAqJ9EemXzuA5M0BZIw" showIcon="false" labelColor="39,76,114"> | ||
10742 | <customFeatures>labelSize</customFeatures> | ||
10743 | </endLabelStyle> | ||
10744 | </ownedStyle> | ||
10745 | <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/> | ||
10746 | </ownedDiagramElements> | ||
10638 | <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/> | 10747 | <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/> |
10639 | <filterVariableHistory xmi:type="diagram:FilterVariableHistory" uid="_l6Zva7dnEeau1vMV3Bsx4w"/> | 10748 | <filterVariableHistory xmi:type="diagram:FilterVariableHistory" uid="_l6Zva7dnEeau1vMV3Bsx4w"/> |
10640 | <activatedLayers xmi:type="description_1:Layer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer"/> | 10749 | <activatedLayers xmi:type="description_1:Layer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer"/> |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore index fdbc1c27..a91d4407 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore | |||
@@ -215,6 +215,9 @@ | |||
215 | <eClassifiers xsi:type="ecore:EClass" name="AggregateExpression" abstract="true" | 215 | <eClassifiers xsi:type="ecore:EClass" name="AggregateExpression" abstract="true" |
216 | eSuperTypes="#//Term"> | 216 | eSuperTypes="#//Term"> |
217 | <eStructuralFeatures xsi:type="ecore:EReference" name="relation" eType="#//Relation"/> | 217 | <eStructuralFeatures xsi:type="ecore:EReference" name="relation" eType="#//Relation"/> |
218 | <eStructuralFeatures xsi:type="ecore:EReference" name="parameterSubstitution" | ||
219 | upperBound="-1" eType="#//AggregatedParameterSubstitution" containment="true"/> | ||
220 | <eStructuralFeatures xsi:type="ecore:EReference" name="resultVariable" eType="#//Variable"/> | ||
218 | </eClassifiers> | 221 | </eClassifiers> |
219 | <eClassifiers xsi:type="ecore:EClass" name="Sum" eSuperTypes="#//ProjectedAggregateExpression"/> | 222 | <eClassifiers xsi:type="ecore:EClass" name="Sum" eSuperTypes="#//ProjectedAggregateExpression"/> |
220 | <eClassifiers xsi:type="ecore:EClass" name="Count" eSuperTypes="#//AggregateExpression"/> | 223 | <eClassifiers xsi:type="ecore:EClass" name="Count" eSuperTypes="#//AggregateExpression"/> |
@@ -225,4 +228,7 @@ | |||
225 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="projectionIndex" lowerBound="1" | 228 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="projectionIndex" lowerBound="1" |
226 | eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" defaultValueLiteral="-1"/> | 229 | eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" defaultValueLiteral="-1"/> |
227 | </eClassifiers> | 230 | </eClassifiers> |
231 | <eClassifiers xsi:type="ecore:EClass" name="AggregatedParameterSubstitution"> | ||
232 | <eStructuralFeatures xsi:type="ecore:EReference" name="variable" eType="#//Variable"/> | ||
233 | </eClassifiers> | ||
228 | </ecore:EPackage> | 234 | </ecore:EPackage> |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.genmodel b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.genmodel index 303080e7..0f35db7c 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.genmodel +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.genmodel | |||
@@ -168,6 +168,8 @@ | |||
168 | <genClasses ecoreClass="logiclanguage.ecore#//Pow"/> | 168 | <genClasses ecoreClass="logiclanguage.ecore#//Pow"/> |
169 | <genClasses image="false" ecoreClass="logiclanguage.ecore#//AggregateExpression"> | 169 | <genClasses image="false" ecoreClass="logiclanguage.ecore#//AggregateExpression"> |
170 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference logiclanguage.ecore#//AggregateExpression/relation"/> | 170 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference logiclanguage.ecore#//AggregateExpression/relation"/> |
171 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference logiclanguage.ecore#//AggregateExpression/parameterSubstitution"/> | ||
172 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference logiclanguage.ecore#//AggregateExpression/resultVariable"/> | ||
171 | </genClasses> | 173 | </genClasses> |
172 | <genClasses ecoreClass="logiclanguage.ecore#//Sum"/> | 174 | <genClasses ecoreClass="logiclanguage.ecore#//Sum"/> |
173 | <genClasses ecoreClass="logiclanguage.ecore#//Count"/> | 175 | <genClasses ecoreClass="logiclanguage.ecore#//Count"/> |
@@ -176,6 +178,9 @@ | |||
176 | <genClasses image="false" ecoreClass="logiclanguage.ecore#//ProjectedAggregateExpression"> | 178 | <genClasses image="false" ecoreClass="logiclanguage.ecore#//ProjectedAggregateExpression"> |
177 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute logiclanguage.ecore#//ProjectedAggregateExpression/projectionIndex"/> | 179 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute logiclanguage.ecore#//ProjectedAggregateExpression/projectionIndex"/> |
178 | </genClasses> | 180 | </genClasses> |
181 | <genClasses ecoreClass="logiclanguage.ecore#//AggregatedParameterSubstitution"> | ||
182 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference logiclanguage.ecore#//AggregatedParameterSubstitution/variable"/> | ||
183 | </genClasses> | ||
179 | </genPackages> | 184 | </genPackages> |
180 | <genPackages prefix="Logicproblem" basePackage="hu.bme.mit.inf.dslreasoner.logic.model" | 185 | <genPackages prefix="Logicproblem" basePackage="hu.bme.mit.inf.dslreasoner.logic.model" |
181 | disposableProviderFactory="true" ecorePackage="logicproblem.ecore#/"> | 186 | disposableProviderFactory="true" ecorePackage="logicproblem.ecore#/"> |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicProblemBuilder.xtend b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicProblemBuilder.xtend index f6bd9541..a231af3c 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicProblemBuilder.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicProblemBuilder.xtend | |||
@@ -1,5 +1,6 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.logic.model.builder | 1 | package hu.bme.mit.inf.dslreasoner.logic.model.builder |
2 | 2 | ||
3 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.AggregateExpression | ||
3 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Assertion | 4 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Assertion |
4 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.BoolTypeReference | 5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.BoolTypeReference |
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.ComplexTypeReference | 6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.ComplexTypeReference |
@@ -8,6 +9,7 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement | |||
8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Function | 9 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Function |
9 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntTypeReference | 10 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntTypeReference |
10 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguageFactory | 11 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguageFactory |
12 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.ProjectedAggregateExpression | ||
11 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.QuantifiedExpression | 13 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.QuantifiedExpression |
12 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealTypeReference | 14 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealTypeReference |
13 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Relation | 15 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Relation |
@@ -46,16 +48,16 @@ class LogicProblemBuilderException extends Exception { | |||
46 | } | 48 | } |
47 | } | 49 | } |
48 | 50 | ||
49 | public class LogicProblemBuilder{ | 51 | class LogicProblemBuilder{ |
50 | val protected extension LogiclanguageFactory logicFactiory = LogiclanguageFactory.eINSTANCE | 52 | val protected extension LogiclanguageFactory logicFactiory = LogiclanguageFactory.eINSTANCE |
51 | val protected extension LogicproblemFactory problemFactory = LogicproblemFactory.eINSTANCE | 53 | val protected extension LogicproblemFactory problemFactory = LogicproblemFactory.eINSTANCE |
52 | val protected advancedConstructs = new LogicProblemBuilder_AdvancedConstructs(this) | 54 | val protected advancedConstructs = new LogicProblemBuilder_AdvancedConstructs(this) |
53 | 55 | ||
54 | def public createProblem(){ createLogicProblem } | 56 | def createProblem(){ createLogicProblem } |
55 | 57 | ||
56 | // Names | 58 | // Names |
57 | def protected String canonize(CharSequence name) { | 59 | def protected String canonize(CharSequence name) { |
58 | if(name == null) return "" | 60 | if(name === null) return "" |
59 | val result = name.toString.split("\\s+"); | 61 | val result = name.toString.split("\\s+"); |
60 | if(result.size == 1) { | 62 | if(result.size == 1) { |
61 | val element = result.get(0); | 63 | val element = result.get(0); |
@@ -82,23 +84,23 @@ public class LogicProblemBuilder{ | |||
82 | } | 84 | } |
83 | 85 | ||
84 | // Type builders | 86 | // Type builders |
85 | def public Element(CharSequence elementName) { return createDefinedElement => [x|x.name = elementName.canonize] } | 87 | def Element(CharSequence elementName) { return createDefinedElement => [x|x.name = elementName.canonize] } |
86 | def public Element() { return createDefinedElement } | 88 | def Element() { return createDefinedElement } |
87 | def public TypeDeclaration(CharSequence name, boolean isAbstract) { TypeDeclaration => [x | x.name = name.canonize x.isAbstract = isAbstract] } | 89 | def TypeDeclaration(CharSequence name, boolean isAbstract) { TypeDeclaration => [x | x.name = name.canonize x.isAbstract = isAbstract] } |
88 | def public TypeDeclaration() { createTypeDeclaration } | 90 | def TypeDeclaration() { createTypeDeclaration } |
89 | def public TypeDefinition(CharSequence name, boolean isAbstract, DefinedElement... elements) { TypeDefinition(name, isAbstract, elements as Iterable<DefinedElement>) } | 91 | def TypeDefinition(CharSequence name, boolean isAbstract, DefinedElement... elements) { TypeDefinition(name, isAbstract, elements as Iterable<DefinedElement>) } |
90 | def public TypeDefinition(CharSequence name, boolean isAbstract, Iterable<DefinedElement> elements) { createTypeDefinition => [x | x.name = name.canonize x.isAbstract = isAbstract x.elements += elements ] } | 92 | def TypeDefinition(CharSequence name, boolean isAbstract, Iterable<DefinedElement> elements) { createTypeDefinition => [x | x.name = name.canonize x.isAbstract = isAbstract x.elements += elements ] } |
91 | 93 | ||
92 | def public Supertype(Type subtype, Type supertype) { | 94 | def Supertype(Type subtype, Type supertype) { |
93 | subtype.supertypes+=supertype | 95 | subtype.supertypes+=supertype |
94 | } | 96 | } |
95 | def public SetSupertype(Type subtype, Type supertype, boolean value) { | 97 | def SetSupertype(Type subtype, Type supertype, boolean value) { |
96 | if(value) subtype.supertypes+=supertype | 98 | if(value) subtype.supertypes+=supertype |
97 | else subtype.subtypes-=supertype | 99 | else subtype.subtypes-=supertype |
98 | } | 100 | } |
99 | 101 | ||
100 | // Type add | 102 | // Type add |
101 | def public add(LogicProblem problem, Type type) { | 103 | def add(LogicProblem problem, Type type) { |
102 | problem.nameIfAnonymType(type) | 104 | problem.nameIfAnonymType(type) |
103 | problem.types+=type | 105 | problem.types+=type |
104 | if(type instanceof TypeDefinition) { | 106 | if(type instanceof TypeDefinition) { |
@@ -118,10 +120,10 @@ public class LogicProblemBuilder{ | |||
118 | element.name = typeDefinition.elements.map[it.name].generateUniqueName[i | '''type «i.toString»'''] | 120 | element.name = typeDefinition.elements.map[it.name].generateUniqueName[i | '''type «i.toString»'''] |
119 | } | 121 | } |
120 | 122 | ||
121 | def public LogicBool() { createBoolTypeReference } | 123 | def LogicBool() { createBoolTypeReference } |
122 | def public LogicInt() { createIntTypeReference } | 124 | def LogicInt() { createIntTypeReference } |
123 | def public LogicReal() { createRealTypeReference } | 125 | def LogicReal() { createRealTypeReference } |
124 | def public LogicString() { createStringTypeReference } | 126 | def LogicString() { createStringTypeReference } |
125 | def toTypeReference(TypeDescriptor descriptor) { | 127 | def toTypeReference(TypeDescriptor descriptor) { |
126 | if(descriptor instanceof TypeReference) { return EcoreUtil.copy(descriptor); } | 128 | if(descriptor instanceof TypeReference) { return EcoreUtil.copy(descriptor); } |
127 | else if(descriptor instanceof Type) { return createComplexTypeReference => [referred = descriptor]} | 129 | else if(descriptor instanceof Type) { return createComplexTypeReference => [referred = descriptor]} |
@@ -129,31 +131,31 @@ public class LogicProblemBuilder{ | |||
129 | } | 131 | } |
130 | 132 | ||
131 | // Variables | 133 | // Variables |
132 | def public createVar(CharSequence name, TypeDescriptor range) { | 134 | def createVar(CharSequence name, TypeDescriptor range) { |
133 | return createVariable => [it.name = name.canonize it.range = range.toTypeReference] | 135 | return createVariable => [it.name = name.canonize it.range = range.toTypeReference] |
134 | } | 136 | } |
135 | 137 | ||
136 | // Functions | 138 | // Functions |
137 | def public FunctionDescription ->(TypeDescriptor parameter, TypeDescriptor range) { return #[parameter] -> range } | 139 | def FunctionDescription ->(TypeDescriptor parameter, TypeDescriptor range) { return #[parameter] -> range } |
138 | def public FunctionDescription ->(Iterable<? extends TypeDescriptor> parameters, TypeDescriptor range) { return new FunctionDescription(parameters.map[toTypeReference], range.toTypeReference); } | 140 | def FunctionDescription ->(Iterable<? extends TypeDescriptor> parameters, TypeDescriptor range) { return new FunctionDescription(parameters.map[toTypeReference], range.toTypeReference); } |
139 | def public FunctionDeclaration(CharSequence name, FunctionDescription functionDescription) { FunctionDeclaration(name,functionDescription.range, functionDescription.parameters) } | 141 | def FunctionDeclaration(CharSequence name, FunctionDescription functionDescription) { FunctionDeclaration(name,functionDescription.range, functionDescription.parameters) } |
140 | def public FunctionDeclaration(FunctionDescription functionDescription) { FunctionDeclaration(functionDescription.range, functionDescription.parameters) } | 142 | def FunctionDeclaration(FunctionDescription functionDescription) { FunctionDeclaration(functionDescription.range, functionDescription.parameters) } |
141 | def public FunctionDeclaration(CharSequence name, TypeDescriptor range, TypeDescriptor... parameters) { FunctionDeclaration(name, range, parameters as Iterable<? extends TypeReference>) } | 143 | def FunctionDeclaration(CharSequence name, TypeDescriptor range, TypeDescriptor... parameters) { FunctionDeclaration(name, range, parameters as Iterable<? extends TypeReference>) } |
142 | def public FunctionDeclaration(TypeDescriptor range, TypeDescriptor... parameters) { FunctionDeclaration(range, parameters as Iterable<? extends TypeReference>) } | 144 | def FunctionDeclaration(TypeDescriptor range, TypeDescriptor... parameters) { FunctionDeclaration(range, parameters as Iterable<? extends TypeReference>) } |
143 | def public FunctionDeclaration(CharSequence name, TypeDescriptor range, Iterable<? extends TypeDescriptor> parameters) { return FunctionDeclaration(range,parameters) => [x|x.name = name.canonize] } | 145 | def FunctionDeclaration(CharSequence name, TypeDescriptor range, Iterable<? extends TypeDescriptor> parameters) { return FunctionDeclaration(range,parameters) => [x|x.name = name.canonize] } |
144 | def public FunctionDeclaration(TypeDescriptor range, Iterable<? extends TypeDescriptor> parameters) { | 146 | def FunctionDeclaration(TypeDescriptor range, Iterable<? extends TypeDescriptor> parameters) { |
145 | val function = createFunctionDeclaration | 147 | val function = createFunctionDeclaration |
146 | for(parameter : parameters) function.parameters+=parameter.toTypeReference | 148 | for(parameter : parameters) function.parameters+=parameter.toTypeReference |
147 | function.range = range.toTypeReference | 149 | function.range = range.toTypeReference |
148 | return function | 150 | return function |
149 | } | 151 | } |
150 | 152 | ||
151 | def public FunctionDefinition(CharSequence name, TypeDescriptor range, Function1<VariableContext, ? extends TermDescription> expression) { | 153 | def FunctionDefinition(CharSequence name, TypeDescriptor range, Function1<VariableContext, ? extends TermDescription> expression) { |
152 | val context = new VariableContext(this,logicFactiory) | 154 | val context = new VariableContext(this,logicFactiory) |
153 | val definition = expression.apply(context) | 155 | val definition = expression.apply(context) |
154 | return FunctionDefinition(name,range,context.variables,definition); | 156 | return FunctionDefinition(name,range,context.variables,definition); |
155 | } | 157 | } |
156 | def public FunctionDefinition(CharSequence name, TypeDescriptor range, Iterable<Variable> variables, TermDescription definition) { | 158 | def FunctionDefinition(CharSequence name, TypeDescriptor range, Iterable<Variable> variables, TermDescription definition) { |
157 | return createFunctionDefinition => [ | 159 | return createFunctionDefinition => [ |
158 | it.name = name.canonize | 160 | it.name = name.canonize |
159 | it.parameters += variables.map[it.range.toTypeReference] | 161 | it.parameters += variables.map[it.range.toTypeReference] |
@@ -162,23 +164,23 @@ public class LogicProblemBuilder{ | |||
162 | it.value = definition.toTerm | 164 | it.value = definition.toTerm |
163 | ] | 165 | ] |
164 | } | 166 | } |
165 | def public FunctionDefinition(CharSequence name, TypeDescriptor range, Iterable<TypeDescriptor> parameters, Map<List<Term>,Term> parametersToValue) { | 167 | def FunctionDefinition(CharSequence name, TypeDescriptor range, Iterable<TypeDescriptor> parameters, Map<List<Term>,Term> parametersToValue) { |
166 | return FunctionDefinition(name,range,parameters,parametersToValue,null) | 168 | return FunctionDefinition(name,range,parameters,parametersToValue,null) |
167 | } | 169 | } |
168 | def public FunctionDefinition(CharSequence name, TypeDescriptor range, Iterable<TypeDescriptor> parameters, Map<List<Term>,Term> parametersToValue, Term defaultValue) { | 170 | def FunctionDefinition(CharSequence name, TypeDescriptor range, Iterable<TypeDescriptor> parameters, Map<List<Term>,Term> parametersToValue, Term defaultValue) { |
169 | val parameterList = parameters.toList; | 171 | val parameterList = parameters.toList; |
170 | val variableList = (1..parameterList.size).map[index | '''param «index»'''.createVar(parameterList.get(index-1))].toList | 172 | val variableList = (1..parameterList.size).map[index | '''param «index»'''.createVar(parameterList.get(index-1))].toList |
171 | return FunctionDefinition(name,range,variableList,advancedConstructs.FunctionDefinitionBody(variableList,parametersToValue,defaultValue)) | 173 | return FunctionDefinition(name,range,variableList,advancedConstructs.FunctionDefinitionBody(variableList,parametersToValue,defaultValue)) |
172 | } | 174 | } |
173 | 175 | ||
174 | // Add function to a problem | 176 | // Add function to a problem |
175 | def public add(LogicProblem input, Function function) { | 177 | def add(LogicProblem input, Function function) { |
176 | input.nameIfAnonymFunction(function) | 178 | input.nameIfAnonymFunction(function) |
177 | input.checkFunction(function) | 179 | input.checkFunction(function) |
178 | input.functions += function | 180 | input.functions += function |
179 | return function | 181 | return function |
180 | } | 182 | } |
181 | def public add(LogicProblem input, FunctionDescription functionDescription) { input.add(FunctionDeclaration(functionDescription)) } | 183 | def add(LogicProblem input, FunctionDescription functionDescription) { input.add(FunctionDeclaration(functionDescription)) } |
182 | def protected nameIfAnonymFunction(LogicProblem problem, Function functionDeclaration) { | 184 | def protected nameIfAnonymFunction(LogicProblem problem, Function functionDeclaration) { |
183 | if(functionDeclaration.name.nullOrEmpty) { | 185 | if(functionDeclaration.name.nullOrEmpty) { |
184 | functionDeclaration.name = problem.functions.map[it.name].generateUniqueName[i | "function"+i] | 186 | functionDeclaration.name = problem.functions.map[it.name].generateUniqueName[i | "function"+i] |
@@ -199,15 +201,15 @@ public class LogicProblemBuilder{ | |||
199 | } | 201 | } |
200 | 202 | ||
201 | // Constants | 203 | // Constants |
202 | def public ConstantDeclaration(CharSequence name, TypeDescriptor type) { ConstantDeclaration(type) => [it.name = name.canonize] } | 204 | def ConstantDeclaration(CharSequence name, TypeDescriptor type) { ConstantDeclaration(type) => [it.name = name.canonize] } |
203 | def public ConstantDeclaration(TypeDescriptor type) { createConstantDeclaration => [it.type = type.toTypeReference] } | 205 | def ConstantDeclaration(TypeDescriptor type) { createConstantDeclaration => [it.type = type.toTypeReference] } |
204 | 206 | ||
205 | def public ConstantDefinition(CharSequence name, TypeDescriptor type, TermDescription value) { | 207 | def ConstantDefinition(CharSequence name, TypeDescriptor type, TermDescription value) { |
206 | createConstantDefinition => [it.name = name.canonize it.type = type.toTypeReference it.value = value.toTerm] | 208 | createConstantDefinition => [it.name = name.canonize it.type = type.toTypeReference it.value = value.toTerm] |
207 | } | 209 | } |
208 | 210 | ||
209 | // Add constant to a problem | 211 | // Add constant to a problem |
210 | def public add(LogicProblem problem, Constant constant) { | 212 | def add(LogicProblem problem, Constant constant) { |
211 | problem.nameIfAnonymConstant(constant); | 213 | problem.nameIfAnonymConstant(constant); |
212 | problem.checkConstant(constant) | 214 | problem.checkConstant(constant) |
213 | problem.constants += constant | 215 | problem.constants += constant |
@@ -226,10 +228,10 @@ public class LogicProblemBuilder{ | |||
226 | } | 228 | } |
227 | 229 | ||
228 | // Relations | 230 | // Relations |
229 | def public RelationDeclaration(CharSequence name, TypeDescriptor... parameters) { return RelationDeclaration(name, parameters as Iterable<? extends TypeReference>) } | 231 | def RelationDeclaration(CharSequence name, TypeDescriptor... parameters) { return RelationDeclaration(name, parameters as Iterable<? extends TypeReference>) } |
230 | def public RelationDeclaration(CharSequence name, Iterable<? extends TypeDescriptor> parameters) { return RelationDeclaration(parameters) => [x|x.name = name.canonize] } | 232 | def RelationDeclaration(CharSequence name, Iterable<? extends TypeDescriptor> parameters) { return RelationDeclaration(parameters) => [x|x.name = name.canonize] } |
231 | def public RelationDeclaration(TypeDescriptor... parameters) { RelationDeclaration( parameters as Iterable<? extends TypeReference>) } | 233 | def RelationDeclaration(TypeDescriptor... parameters) { RelationDeclaration( parameters as Iterable<? extends TypeReference>) } |
232 | def public RelationDeclaration(Iterable<? extends TypeDescriptor> parameters) { | 234 | def RelationDeclaration(Iterable<? extends TypeDescriptor> parameters) { |
233 | val relation = createRelationDeclaration | 235 | val relation = createRelationDeclaration |
234 | for(parameter : parameters) { | 236 | for(parameter : parameters) { |
235 | relation.parameters+=parameter.toTypeReference | 237 | relation.parameters+=parameter.toTypeReference |
@@ -237,12 +239,12 @@ public class LogicProblemBuilder{ | |||
237 | return relation | 239 | return relation |
238 | } | 240 | } |
239 | 241 | ||
240 | def public RelationDefinition(CharSequence name, Function1<VariableContext, ? extends TermDescription> expression) { | 242 | def RelationDefinition(CharSequence name, Function1<VariableContext, ? extends TermDescription> expression) { |
241 | val context = new VariableContext(this,logicFactiory); | 243 | val context = new VariableContext(this,logicFactiory); |
242 | val definition = expression.apply(context); | 244 | val definition = expression.apply(context); |
243 | return RelationDefinition(name,context.variables,definition) | 245 | return RelationDefinition(name,context.variables,definition) |
244 | } | 246 | } |
245 | def public RelationDefinition(CharSequence name, Iterable<Variable> variables, TermDescription definition) { | 247 | def RelationDefinition(CharSequence name, Iterable<Variable> variables, TermDescription definition) { |
246 | return createRelationDefinition => [ | 248 | return createRelationDefinition => [ |
247 | it.name = name.canonize | 249 | it.name = name.canonize |
248 | it.parameters += variables.map[it.range.toTypeReference] | 250 | it.parameters += variables.map[it.range.toTypeReference] |
@@ -250,7 +252,7 @@ public class LogicProblemBuilder{ | |||
250 | it.value = definition?.toTerm | 252 | it.value = definition?.toTerm |
251 | ] | 253 | ] |
252 | } | 254 | } |
253 | def public RelationDefinition(CharSequence name, Iterable<? extends TypeDescriptor> parameters, Iterable<? extends List<? extends TermDescription>> possibleValues) { | 255 | def RelationDefinition(CharSequence name, Iterable<? extends TypeDescriptor> parameters, Iterable<? extends List<? extends TermDescription>> possibleValues) { |
254 | val res = createRelationDefinition => [it.name = name.canonize] | 256 | val res = createRelationDefinition => [it.name = name.canonize] |
255 | val variableMap = new ArrayList(parameters.size) | 257 | val variableMap = new ArrayList(parameters.size) |
256 | var index = 0 | 258 | var index = 0 |
@@ -267,7 +269,7 @@ public class LogicProblemBuilder{ | |||
267 | } | 269 | } |
268 | 270 | ||
269 | // Add Relation to a problem | 271 | // Add Relation to a problem |
270 | def public add(LogicProblem input, Relation relation) { | 272 | def add(LogicProblem input, Relation relation) { |
271 | input.nameIfAnonymRelation(relation) | 273 | input.nameIfAnonymRelation(relation) |
272 | input.checkRelation(relation) | 274 | input.checkRelation(relation) |
273 | input.relations+=relation | 275 | input.relations+=relation |
@@ -293,17 +295,17 @@ public class LogicProblemBuilder{ | |||
293 | } | 295 | } |
294 | 296 | ||
295 | // Assertion | 297 | // Assertion |
296 | def public Assertion(TermDescription term) { | 298 | def Assertion(TermDescription term) { |
297 | val result = term.toTerm | 299 | val result = term.toTerm |
298 | result.nameAnonymVariables(Collections.EMPTY_LIST) | 300 | result.nameAnonymVariables(Collections.EMPTY_LIST) |
299 | createAssertion => [it.value = result] | 301 | createAssertion => [it.value = result] |
300 | } | 302 | } |
301 | def public Assertion(CharSequence name, TermDescription term) { | 303 | def Assertion(CharSequence name, TermDescription term) { |
302 | val result = term.toTerm | 304 | val result = term.toTerm |
303 | result.nameAnonymVariables(Collections.EMPTY_LIST) | 305 | result.nameAnonymVariables(Collections.EMPTY_LIST) |
304 | createAssertion => [it.value = result it.name=name.canonize] | 306 | createAssertion => [it.value = result it.name=name.canonize] |
305 | } | 307 | } |
306 | def public add(LogicProblem problem, Assertion assertion) { | 308 | def add(LogicProblem problem, Assertion assertion) { |
307 | if(assertion.name.nullOrEmpty) { | 309 | if(assertion.name.nullOrEmpty) { |
308 | val name = problem.assertions.map[name].generateUniqueName["assertion"+it] | 310 | val name = problem.assertions.map[name].generateUniqueName["assertion"+it] |
309 | assertion.name=name | 311 | assertion.name=name |
@@ -313,7 +315,7 @@ public class LogicProblemBuilder{ | |||
313 | return assertion | 315 | return assertion |
314 | } | 316 | } |
315 | 317 | ||
316 | def public add(LogicProblem problem, TermDescription term) { | 318 | def add(LogicProblem problem, TermDescription term) { |
317 | problem.add(Assertion(term)) | 319 | problem.add(Assertion(term)) |
318 | } | 320 | } |
319 | 321 | ||
@@ -329,7 +331,7 @@ public class LogicProblemBuilder{ | |||
329 | } | 331 | } |
330 | } | 332 | } |
331 | 333 | ||
332 | def public checkDefinition(EObject definition) { | 334 | def checkDefinition(EObject definition) { |
333 | /*for(value : definition.eAllContents.filter(SymbolicValue).toIterable) { | 335 | /*for(value : definition.eAllContents.filter(SymbolicValue).toIterable) { |
334 | var referred = value.symbolicReference | 336 | var referred = value.symbolicReference |
335 | if(referred instanceof Variable) { | 337 | if(referred instanceof Variable) { |
@@ -341,7 +343,7 @@ public class LogicProblemBuilder{ | |||
341 | } | 343 | } |
342 | 344 | ||
343 | // Containment | 345 | // Containment |
344 | def public ContainmentHierarchy( | 346 | def ContainmentHierarchy( |
345 | Iterable<? extends Type> typesInHierarchy, | 347 | Iterable<? extends Type> typesInHierarchy, |
346 | Iterable<? extends Function> containmentFunctions, | 348 | Iterable<? extends Function> containmentFunctions, |
347 | Iterable<? extends Relation> containmentRelations, | 349 | Iterable<? extends Relation> containmentRelations, |
@@ -355,7 +357,7 @@ public class LogicProblemBuilder{ | |||
355 | ] | 357 | ] |
356 | return result | 358 | return result |
357 | } | 359 | } |
358 | def public add(LogicProblem problem, ContainmentHierarchy hierarchy) { | 360 | def add(LogicProblem problem, ContainmentHierarchy hierarchy) { |
359 | problem.containmentHierarchies+=hierarchy | 361 | problem.containmentHierarchies+=hierarchy |
360 | return hierarchy | 362 | return hierarchy |
361 | } | 363 | } |
@@ -413,7 +415,7 @@ public class LogicProblemBuilder{ | |||
413 | return result; | 415 | return result; |
414 | } | 416 | } |
415 | 417 | ||
416 | def public Term toTerm(TermDescription term) { | 418 | def Term toTerm(TermDescription term) { |
417 | if(term instanceof Term) return term | 419 | if(term instanceof Term) return term |
418 | else if (term instanceof Variable) return createSymbolicValue => [symbolicReference = term] | 420 | else if (term instanceof Variable) return createSymbolicValue => [symbolicReference = term] |
419 | else if (term instanceof Constant) return term.call() | 421 | else if (term instanceof Constant) return term.call() |
@@ -421,74 +423,75 @@ public class LogicProblemBuilder{ | |||
421 | else throw new UnsupportedOperationException("Can not create reference for symbolic declaration " + term.class.name) | 423 | else throw new UnsupportedOperationException("Can not create reference for symbolic declaration " + term.class.name) |
422 | } | 424 | } |
423 | 425 | ||
424 | def public !(TermDescription term) { Not(term) } | 426 | def !(TermDescription term) { Not(term) } |
425 | def public Not(TermDescription term) { createNot => [operand = term.toTerm] } | 427 | def Not(TermDescription term) { createNot => [operand = term.toTerm] } |
426 | 428 | ||
427 | def public &&(TermDescription a, TermDescription b) { And(a,b) } | 429 | def &&(TermDescription a, TermDescription b) { And(a,b) } |
428 | def public And(TermDescription... terms) { return And(terms as Iterable<? extends TermDescription>) } | 430 | def And(TermDescription... terms) { return And(terms as Iterable<? extends TermDescription>) } |
429 | def public And(Iterable<? extends TermDescription> terms) { createAnd => [operands += terms.map[toTerm]] } | 431 | def And(Iterable<? extends TermDescription> terms) { createAnd => [operands += terms.map[toTerm]] } |
430 | 432 | ||
431 | def public ||(TermDescription a, TermDescription b) { Or(a,b) } | 433 | def ||(TermDescription a, TermDescription b) { Or(a,b) } |
432 | def public Or(TermDescription... terms) { Or(terms as Iterable<? extends TermDescription>) } | 434 | def Or(TermDescription... terms) { Or(terms as Iterable<? extends TermDescription>) } |
433 | def public Or(Iterable<? extends TermDescription> terms) { createOr => [operands += terms.map[toTerm]] } | 435 | def Or(Iterable<? extends TermDescription> terms) { createOr => [operands += terms.map[toTerm]] } |
434 | 436 | ||
435 | def public =>(TermDescription a, TermDescription b) { Impl(a,b) } | 437 | def =>(TermDescription a, TermDescription b) { Impl(a,b) } |
436 | def public Impl(TermDescription a, TermDescription b) { createImpl => [leftOperand = a.toTerm rightOperand = b.toTerm] } | 438 | def Impl(TermDescription a, TermDescription b) { createImpl => [leftOperand = a.toTerm rightOperand = b.toTerm] } |
437 | 439 | ||
438 | def public <=>(TermDescription a, TermDescription b) { Iff(a,b)} | 440 | def <=>(TermDescription a, TermDescription b) { Iff(a,b)} |
439 | def public Iff(TermDescription a, TermDescription b) { createIff =>[leftOperand=a.toTerm rightOperand=b.toTerm] } | 441 | def Iff(TermDescription a, TermDescription b) { createIff =>[leftOperand=a.toTerm rightOperand=b.toTerm] } |
440 | 442 | ||
441 | def public ITE(TermDescription condition, TermDescription ifTrue, TermDescription ifFalse) { | 443 | def ITE(TermDescription condition, TermDescription ifTrue, TermDescription ifFalse) { |
442 | createIfThenElse => [it.condition = condition.toTerm it.ifTrue = ifTrue.toTerm it.ifFalse = ifFalse.toTerm] | 444 | createIfThenElse => [it.condition = condition.toTerm it.ifTrue = ifTrue.toTerm it.ifFalse = ifFalse.toTerm] |
443 | } | 445 | } |
444 | 446 | ||
445 | def public >(TermDescription left, TermDescription right) { MoreThan(left,right)} | 447 | def >(TermDescription left, TermDescription right) { MoreThan(left,right)} |
446 | def public MoreThan(TermDescription left, TermDescription right) { createMoreThan => [leftOperand=left.toTerm rightOperand=right.toTerm] } | 448 | def MoreThan(TermDescription left, TermDescription right) { createMoreThan => [leftOperand=left.toTerm rightOperand=right.toTerm] } |
447 | 449 | ||
448 | def public <(TermDescription left, TermDescription right) { LessThan(left,right)} | 450 | def <(TermDescription left, TermDescription right) { LessThan(left,right)} |
449 | def public LessThan(TermDescription left, TermDescription right) { createLessThan => [leftOperand=left.toTerm rightOperand=right.toTerm] } | 451 | def LessThan(TermDescription left, TermDescription right) { createLessThan => [leftOperand=left.toTerm rightOperand=right.toTerm] } |
450 | 452 | ||
451 | def public <=(TermDescription left, TermDescription right) { LessOrEqual(left,right) } | 453 | def <=(TermDescription left, TermDescription right) { LessOrEqual(left,right) } |
452 | def public LessOrEqual(TermDescription left, TermDescription right) { createLessOrEqualThan => [leftOperand=left.toTerm rightOperand=right.toTerm] } | 454 | def LessOrEqual(TermDescription left, TermDescription right) { createLessOrEqualThan => [leftOperand=left.toTerm rightOperand=right.toTerm] } |
453 | 455 | ||
454 | def public >=(TermDescription left, TermDescription right) { MoreOrEqual(left,right) } | 456 | def >=(TermDescription left, TermDescription right) { MoreOrEqual(left,right) } |
455 | def public MoreOrEqual(TermDescription left, TermDescription right) { createMoreOrEqualThan => [leftOperand=left.toTerm rightOperand=right.toTerm] } | 457 | def MoreOrEqual(TermDescription left, TermDescription right) { createMoreOrEqualThan => [leftOperand=left.toTerm rightOperand=right.toTerm] } |
456 | 458 | ||
457 | def public ==(TermDescription left, TermDescription right) {Equals(left,right)} | 459 | def ==(TermDescription left, TermDescription right) {Equals(left,right)} |
458 | def public Equals(TermDescription left, TermDescription right) { createEquals => [leftOperand=left.toTerm rightOperand=right.toTerm] } | 460 | def Equals(TermDescription left, TermDescription right) { createEquals => [leftOperand=left.toTerm rightOperand=right.toTerm] } |
459 | 461 | ||
460 | def public !=(TermDescription left, TermDescription right) { Distinct(left,right) } | 462 | def !=(TermDescription left, TermDescription right) { Distinct(left,right) } |
461 | def public Distinct(TermDescription... terms) { return Distinct(terms as Iterable<? extends TermDescription>) } | 463 | def Distinct(TermDescription... terms) { return Distinct(terms as Iterable<? extends TermDescription>) } |
462 | def public Distinct(Iterable<? extends TermDescription> terms) { createDistinct => [operands += terms.map[toTerm]] } | 464 | def Distinct(Iterable<? extends TermDescription> terms) { createDistinct => [operands += terms.map[toTerm]] } |
463 | 465 | ||
464 | def public +(TermDescription left, TermDescription right) { Plus(left,right) } | 466 | def +(TermDescription left, TermDescription right) { Plus(left,right) } |
465 | def public Plus(TermDescription left, TermDescription right) { createPlus => [leftOperand=left.toTerm rightOperand=right.toTerm] } | 467 | def Plus(TermDescription left, TermDescription right) { createPlus => [leftOperand=left.toTerm rightOperand=right.toTerm] } |
466 | 468 | ||
467 | def public -(TermDescription left, TermDescription right) { Minus(left,right) } | 469 | def -(TermDescription left, TermDescription right) { Minus(left,right) } |
468 | def public Minus(TermDescription left, TermDescription right) { createMinus => [leftOperand=left.toTerm rightOperand=right.toTerm] } | 470 | def Minus(TermDescription left, TermDescription right) { createMinus => [leftOperand=left.toTerm rightOperand=right.toTerm] } |
469 | 471 | ||
470 | def public *(TermDescription left, TermDescription right) { Multiply(left,right) } | 472 | def *(TermDescription left, TermDescription right) { Multiply(left,right) } |
471 | def public Multiply(TermDescription left, TermDescription right) { createMultiply => [leftOperand=left.toTerm rightOperand=right.toTerm] } | 473 | def Multiply(TermDescription left, TermDescription right) { createMultiply => [leftOperand=left.toTerm rightOperand=right.toTerm] } |
472 | 474 | ||
473 | def public /(TermDescription left, TermDescription right) { Divide(left,right) } | 475 | def /(TermDescription left, TermDescription right) { Divide(left,right) } |
474 | def public Divide(TermDescription left, TermDescription right) { createDivison => [leftOperand = left.toTerm rightOperand = right.toTerm]} | 476 | def Divide(TermDescription left, TermDescription right) { createDivison => [leftOperand = left.toTerm rightOperand = right.toTerm]} |
475 | 477 | ||
476 | def public %(TermDescription left, TermDescription right) { Modulo(left,right) } | 478 | def %(TermDescription left, TermDescription right) { Modulo(left,right) } |
477 | def public Modulo(TermDescription left, TermDescription right) { createMod => [leftOperand = left.toTerm rightOperand = right.toTerm]} | 479 | def Modulo(TermDescription left, TermDescription right) { createMod => [leftOperand = left.toTerm rightOperand = right.toTerm]} |
478 | 480 | ||
479 | def public asTerm(boolean value) { createBoolLiteral => [x|x.value = value] } | 481 | def Pow(TermDescription left, TermDescription right) {createPow => [leftOperand = left.toTerm rightOperand = right.toTerm]} |
480 | def public asTerm(int value) { createIntLiteral => [x|x.value = value] } | 482 | def asTerm(boolean value) { createBoolLiteral => [x|x.value = value] } |
481 | def public asTerm(double value) { BigDecimal.valueOf(value).asTerm } | 483 | def asTerm(int value) { createIntLiteral => [x|x.value = value] } |
482 | def public asTerm(float value) { BigDecimal.valueOf(value).asTerm } | 484 | def asTerm(double value) { BigDecimal.valueOf(value).asTerm } |
483 | def public asTerm(BigDecimal value) { createRealLiteral => [x|x.value = value] } | 485 | def asTerm(float value) { BigDecimal.valueOf(value).asTerm } |
484 | def public asTerm(String value) { createStringLiteral => [x|x.value = value]} | 486 | def asTerm(BigDecimal value) { createRealLiteral => [x|x.value = value] } |
485 | def public InstanceOf(TermDescription term, TypeDescriptor type) { | 487 | def asTerm(String value) { createStringLiteral => [x|x.value = value]} |
488 | def InstanceOf(TermDescription term, TypeDescriptor type) { | ||
486 | createInstanceOf => [ | 489 | createInstanceOf => [ |
487 | it.value = term.toTerm | 490 | it.value = term.toTerm |
488 | it.range = type.toTypeReference | 491 | it.range = type.toTypeReference |
489 | ] | 492 | ] |
490 | } | 493 | } |
491 | def public transitiveClosure(Relation relation, TermDescription source, TermDescription target) { | 494 | def transitiveClosure(Relation relation, TermDescription source, TermDescription target) { |
492 | createTransitiveClosure => [ | 495 | createTransitiveClosure => [ |
493 | it.relation = relation | 496 | it.relation = relation |
494 | it.leftOperand = leftOperand | 497 | it.leftOperand = leftOperand |
@@ -498,38 +501,88 @@ public class LogicProblemBuilder{ | |||
498 | 501 | ||
499 | // QuantifiedExpressions | 502 | // QuantifiedExpressions |
500 | 503 | ||
501 | def public Forall(Function1<VariableContext, ? extends TermDescription> expression) { | 504 | def Forall(Function1<VariableContext, ? extends TermDescription> expression) { |
502 | val context = new VariableContext(this,logicFactiory) | 505 | val context = new VariableContext(this,logicFactiory) |
503 | val term = expression.apply(context) | 506 | val term = expression.apply(context) |
504 | return createForall => [x| x.quantifiedVariables+=context.variables x.expression = term.toTerm] | 507 | return createForall => [x| x.quantifiedVariables+=context.variables x.expression = term.toTerm] |
505 | } | 508 | } |
506 | def public Forall(TermDescription expression, Variable... variables) { | 509 | def Forall(TermDescription expression, Variable... variables) { |
507 | Forall(variables,expression) } | 510 | Forall(variables,expression) } |
508 | def public Forall(Iterable<? extends Variable> variables,TermDescription expression) { | 511 | def Forall(Iterable<? extends Variable> variables,TermDescription expression) { |
509 | val forallExpression = createForall | 512 | val forallExpression = createForall |
510 | for(variable : variables) forallExpression.quantifiedVariables += variable | 513 | for(variable : variables) forallExpression.quantifiedVariables += variable |
511 | forallExpression.expression = expression.toTerm | 514 | forallExpression.expression = expression.toTerm |
512 | return forallExpression | 515 | return forallExpression |
513 | } | 516 | } |
514 | 517 | ||
515 | def public Exists(Function1<VariableContext, ? extends TermDescription> expression) { | 518 | def Exists(Function1<VariableContext, ? extends TermDescription> expression) { |
516 | val context = new VariableContext(this,logicFactiory) | 519 | val context = new VariableContext(this,logicFactiory) |
517 | val term = expression.apply(context) | 520 | val term = expression.apply(context) |
518 | return createExists => [x| x.quantifiedVariables+=context.variables x.expression = term.toTerm] | 521 | return createExists => [x| x.quantifiedVariables+=context.variables x.expression = term.toTerm] |
519 | } | 522 | } |
520 | def public Exists(TermDescription expression, Variable... variables) { | 523 | def Exists(TermDescription expression, Variable... variables) { |
521 | Exists(variables,expression) } | 524 | Exists(variables,expression) } |
522 | def public Exists(Iterable<? extends Variable> variables, TermDescription expression) { | 525 | def Exists(Iterable<? extends Variable> variables, TermDescription expression) { |
523 | val existsExpression = createExists | 526 | val existsExpression = createExists |
524 | for(variable : variables) existsExpression.quantifiedVariables += variable | 527 | for(variable : variables) existsExpression.quantifiedVariables += variable |
525 | existsExpression.expression = expression.toTerm | 528 | existsExpression.expression = expression.toTerm |
526 | return existsExpression | 529 | return existsExpression |
527 | } | 530 | } |
528 | 531 | ||
532 | // AggregatedExpression | ||
533 | |||
534 | private def <T extends AggregateExpression> configureAggregateExpression(T expression, Relation referred, List<Variable> terms, Variable target) { | ||
535 | if(terms.size != referred.parameters.size) { | ||
536 | throw new LogicProblemBuilderException( | ||
537 | '''The function called has «referred.parameters.size» parameters but it is called with «terms.size»!''') | ||
538 | } else { | ||
539 | expression.relation = referred | ||
540 | expression.resultVariable = target | ||
541 | for(var i=0; i<referred.parameters.size;i++) { | ||
542 | val targetRelation = terms.get(i) | ||
543 | val substitution = createAggregatedParameterSubstitution => [it.variable = targetRelation] | ||
544 | expression.parameterSubstitution += substitution | ||
545 | } | ||
546 | return expression | ||
547 | } | ||
548 | } | ||
549 | private def <T extends ProjectedAggregateExpression> configureProjectedAggregateExpression(T expression, Relation referred, List<Variable> terms, Variable target, int projection) { | ||
550 | if(projection < 0 || projection >= referred.parameters.size) { | ||
551 | throw new LogicProblemBuilderException( | ||
552 | '''The function called has «referred.parameters.size» parameters but it is called with «terms.size»!''') | ||
553 | } else { | ||
554 | val res = expression.configureAggregateExpression(referred, terms,target) | ||
555 | if(res.parameterSubstitution.get(projection).variable !== null) { | ||
556 | throw new LogicProblemBuilderException( | ||
557 | '''Projection over set variable!''') | ||
558 | } | ||
559 | val projectionType = referred.parameters.get(projection) | ||
560 | if(!(projectionType instanceof IntTypeReference || projectionType instanceof RealTypeReference)) { | ||
561 | throw new LogicProblemBuilderException('''Projection over nunnumeric parameter!''' | ||
562 | ) | ||
563 | } | ||
564 | res.projectionIndex = projection | ||
565 | return res | ||
566 | } | ||
567 | |||
568 | } | ||
569 | def Count(Relation referred, List<Variable> terms, Variable result) { | ||
570 | createCount.configureAggregateExpression(referred,terms,result) | ||
571 | } | ||
572 | def Sum(Relation referred, List<Variable> terms, int projection, Variable result) { | ||
573 | createSum.configureProjectedAggregateExpression(referred,terms,result,projection) | ||
574 | } | ||
575 | def Min(Relation referred, List<Variable> terms, int projection, Variable result) { | ||
576 | createMin.configureProjectedAggregateExpression(referred,terms,result,projection) | ||
577 | } | ||
578 | def Max(Relation referred, List<Variable> terms, int projection, Variable result) { | ||
579 | createMax.configureProjectedAggregateExpression(referred,terms,result,projection) | ||
580 | } | ||
581 | |||
529 | // Function calls | 582 | // Function calls |
530 | def public call(Function function, TermDescription... substitutions) { | 583 | def call(Function function, TermDescription... substitutions) { |
531 | call(function, substitutions as Iterable<? extends TermDescription>) } | 584 | call(function, substitutions as Iterable<? extends TermDescription>) } |
532 | def public call(Function function, Iterable<? extends TermDescription> substitutions) { | 585 | def call(Function function, Iterable<? extends TermDescription> substitutions) { |
533 | val functionReference = createSymbolicValue | 586 | val functionReference = createSymbolicValue |
534 | functionReference.symbolicReference=function | 587 | functionReference.symbolicReference=function |
535 | val List<TermDescription> l= new LinkedList() | 588 | val List<TermDescription> l= new LinkedList() |
@@ -546,20 +599,22 @@ public class LogicProblemBuilder{ | |||
546 | } | 599 | } |
547 | 600 | ||
548 | // Relation calls | 601 | // Relation calls |
549 | def public call(Relation relation, TermDescription... substitution) { relation.call(substitution as Iterable<? extends TermDescription>)} | 602 | def call(Relation relation, TermDescription... substitution) { relation.call(substitution as Iterable<? extends TermDescription>)} |
550 | def public call(Relation relation, Iterable<? extends TermDescription> substitution) { | 603 | def call(Relation relation, Iterable<? extends TermDescription> substitution) { |
551 | val relationReference = createSymbolicValue | 604 | val relationReference = createSymbolicValue |
605 | if(relation === null) { | ||
606 | throw new LogicProblemBuilderException('''Call is referring to null!''') | ||
607 | } | ||
552 | relationReference.symbolicReference = relation | 608 | relationReference.symbolicReference = relation |
553 | //println('''«relation.name»(«substitution.size»->«relation.parameters»)''') | ||
554 | for(value : substitution) | 609 | for(value : substitution) |
555 | relationReference.parameterSubstitutions += value.toTerm | 610 | relationReference.parameterSubstitutions += value.toTerm |
556 | relationReference.checkRelationCall(relation) | 611 | relationReference.checkRelationCall(relation) |
557 | return relationReference | 612 | return relationReference |
558 | } | 613 | } |
559 | def private checkRelationCall(SymbolicValue value, Relation referredRelation) { | 614 | def private checkRelationCall(SymbolicValue value, Relation referredRelation) { |
560 | // if(value === null || referredRelation === null) { | 615 | if(value === null || referredRelation === null) { |
561 | // println("gebasz") | 616 | throw new LogicProblemBuilderException('''Call is referring to null!''') |
562 | // } | 617 | } |
563 | if(value.parameterSubstitutions.size != referredRelation.parameters.size) { | 618 | if(value.parameterSubstitutions.size != referredRelation.parameters.size) { |
564 | throw new LogicProblemBuilderException( | 619 | throw new LogicProblemBuilderException( |
565 | '''The relation "«referredRelation.name»" called has «referredRelation.parameters.size» parameters but it is called with «value.parameterSubstitutions.size»!''') | 620 | '''The relation "«referredRelation.name»" called has «referredRelation.parameters.size» parameters but it is called with «value.parameterSubstitutions.size»!''') |
@@ -567,11 +622,9 @@ public class LogicProblemBuilder{ | |||
567 | } | 622 | } |
568 | 623 | ||
569 | // constant evaluation | 624 | // constant evaluation |
570 | def public call(Constant constant) { | 625 | def call(Constant constant) { |
571 | val constantReference = createSymbolicValue | 626 | val constantReference = createSymbolicValue |
572 | constantReference.symbolicReference = constant | 627 | constantReference.symbolicReference = constant |
573 | return constantReference | 628 | return constantReference |
574 | } | 629 | } |
575 | |||
576 | |||
577 | } | 630 | } |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/META-INF/MANIFEST.MF b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/META-INF/MANIFEST.MF index 8fa4517d..6aa9b63e 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/META-INF/MANIFEST.MF +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/META-INF/MANIFEST.MF | |||
@@ -18,7 +18,8 @@ Require-Bundle: com.google.guava, | |||
18 | hu.bme.mit.inf.dslreasoner.logic.model;bundle-version="1.0.0";visibility:=reexport, | 18 | hu.bme.mit.inf.dslreasoner.logic.model;bundle-version="1.0.0";visibility:=reexport, |
19 | org.eclipse.viatra.query.runtime.base.itc;bundle-version="1.5.0", | 19 | org.eclipse.viatra.query.runtime.base.itc;bundle-version="1.5.0", |
20 | org.eclipse.viatra.query.patternlanguage.emf;bundle-version="2.0.0", | 20 | org.eclipse.viatra.query.patternlanguage.emf;bundle-version="2.0.0", |
21 | org.eclipse.xtext | 21 | org.eclipse.xtext, |
22 | org.eclipse.xtext.xbase;bundle-version="2.18.0" | ||
22 | Bundle-ActivationPolicy: lazy | 23 | Bundle-ActivationPolicy: lazy |
23 | Export-Package: hu.bme.mit.inf.dslreasoner.viatra2logic, | 24 | Export-Package: hu.bme.mit.inf.dslreasoner.viatra2logic, |
24 | hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations, | 25 | hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations, |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Constraint2Logic.xtend b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Constraint2Logic.xtend index 3e8b3366..ffbca0af 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Constraint2Logic.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Constraint2Logic.xtend | |||
@@ -30,10 +30,20 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeCo | |||
30 | 30 | ||
31 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | 31 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* |
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint | 32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint |
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint | ||
34 | import org.eclipse.viatra.query.runtime.matchers.aggregators.DoubleSumOperator | ||
35 | import org.eclipse.viatra.query.runtime.matchers.aggregators.IntegerSumOperator | ||
36 | import org.eclipse.viatra.query.runtime.matchers.aggregators.LongSumOperator | ||
37 | import org.eclipse.viatra.query.runtime.matchers.aggregators.ExtremumOperator | ||
38 | import org.eclipse.viatra.query.runtime.matchers.aggregators.ExtremumOperator.Extreme | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation | ||
33 | 41 | ||
34 | class Constraint2Logic { | 42 | class Constraint2Logic { |
35 | val extension LogicProblemBuilder builder = new LogicProblemBuilder | 43 | val extension LogicProblemBuilder builder = new LogicProblemBuilder |
36 | val Ecore2Logic ecore2Logic | 44 | val Ecore2Logic ecore2Logic |
45 | val ExpressionEvaluation2Logic expressionEvaliation2Logic = new ExpressionEvaluation2Logic | ||
46 | val expressionExtractor = new XExpressionExtractor | ||
37 | 47 | ||
38 | new(Ecore2Logic ecore2Logic) { | 48 | new(Ecore2Logic ecore2Logic) { |
39 | this.ecore2Logic = ecore2Logic | 49 | this.ecore2Logic = ecore2Logic |
@@ -269,6 +279,65 @@ class Constraint2Logic { | |||
269 | } else throw new IllegalArgumentException('''unknown tuple: «tuple»''') | 279 | } else throw new IllegalArgumentException('''unknown tuple: «tuple»''') |
270 | } | 280 | } |
271 | 281 | ||
282 | def dispatch Term transformConstraint(AggregatorConstraint constraint, | ||
283 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | ||
284 | Viatra2LogicTrace viatra2LogicTrace, | ||
285 | Map<PVariable, Variable> variable2Variable, | ||
286 | Viatra2LogicConfiguration config) | ||
287 | { | ||
288 | val logicReferred = constraint.referredQuery.lookup(viatra2LogicTrace.query2Relation) | ||
289 | val parameterSubstitution = new LinkedList | ||
290 | for(index : 0..<constraint.actualParametersTuple.size) { | ||
291 | val term = (constraint.actualParametersTuple.get(index) as PVariable).lookup(variable2Variable) | ||
292 | parameterSubstitution += term | ||
293 | } | ||
294 | val aggregatorIndex = constraint.aggregatedColumn | ||
295 | val logicResultVariable = constraint.resultVariable.lookup(variable2Variable) | ||
296 | val type = constraint.aggregator.operator | ||
297 | if(type === null) { | ||
298 | return Count(logicReferred,parameterSubstitution,logicResultVariable) | ||
299 | } else if(type instanceof IntegerSumOperator || type instanceof DoubleSumOperator || type instanceof LongSumOperator){ | ||
300 | return Sum(logicReferred,parameterSubstitution,aggregatorIndex,logicResultVariable) | ||
301 | } else if(type instanceof ExtremumOperator) { | ||
302 | if(type.name == Extreme.MIN.name.toLowerCase) { | ||
303 | return Min(logicReferred,parameterSubstitution,aggregatorIndex,logicResultVariable) | ||
304 | } else if(type.name == Extreme.MAX.name.toLowerCase){ | ||
305 | return Max(logicReferred,parameterSubstitution,aggregatorIndex,logicResultVariable) | ||
306 | } else { | ||
307 | throw new UnsupportedOperationException('''Unkown Extremum aggregator type: «type.name»''') | ||
308 | } | ||
309 | } else { | ||
310 | throw new UnsupportedOperationException('''Unkown aggregator type: «type.name»''') | ||
311 | } | ||
312 | } | ||
313 | |||
314 | def dispatch Term transformConstraint(PatternMatchCounter constraint, | ||
315 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | ||
316 | Viatra2LogicTrace viatra2LogicTrace, | ||
317 | Map<PVariable, Variable> variable2Variable, | ||
318 | Viatra2LogicConfiguration config) | ||
319 | { | ||
320 | val logicReferred = constraint.referredQuery.lookup(viatra2LogicTrace.query2Relation) | ||
321 | val parameterSubstitution = new LinkedList | ||
322 | for(index : 0..<constraint.actualParametersTuple.size) { | ||
323 | val term = (constraint.actualParametersTuple.get(index) as PVariable).lookup(variable2Variable) | ||
324 | parameterSubstitution += term | ||
325 | } | ||
326 | val logicResultVariable = constraint.resultVariable.lookup(variable2Variable) | ||
327 | return Count(logicReferred,parameterSubstitution,logicResultVariable) | ||
328 | } | ||
329 | |||
330 | def dispatch Term transformConstraint(ExpressionEvaluation constraint, | ||
331 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | ||
332 | Viatra2LogicTrace viatra2LogicTrace, | ||
333 | Map<PVariable, Variable> variable2Variable, | ||
334 | Viatra2LogicConfiguration config) | ||
335 | { | ||
336 | val outputVariable = constraint.outputVariable | ||
337 | val expression = expressionExtractor.extractExpression(constraint.evaluator) | ||
338 | return expressionEvaliation2Logic.transformEval(outputVariable,expression,variable2Variable) | ||
339 | } | ||
340 | |||
272 | def dispatch Term transformConstraint(PConstraint constraint, | 341 | def dispatch Term transformConstraint(PConstraint constraint, |
273 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | 342 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, |
274 | Viatra2LogicTrace viatra2LogicTrace, | 343 | Viatra2LogicTrace viatra2LogicTrace, |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/ExpressionEvaluation2Logic.xtend b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/ExpressionEvaluation2Logic.xtend new file mode 100644 index 00000000..f474ded4 --- /dev/null +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/ExpressionEvaluation2Logic.xtend | |||
@@ -0,0 +1,132 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatra2logic | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder | ||
4 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Term | ||
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Variable | ||
6 | import java.util.Map | ||
7 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable | ||
8 | import org.eclipse.xtext.xbase.XBinaryOperation | ||
9 | import org.eclipse.xtext.xbase.XExpression | ||
10 | import org.eclipse.xtext.xbase.XFeatureCall | ||
11 | import org.eclipse.xtext.xbase.XMemberFeatureCall | ||
12 | import org.eclipse.xtext.xbase.XNumberLiteral | ||
13 | import org.eclipse.xtext.xbase.XUnaryOperation | ||
14 | |||
15 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | ||
16 | |||
17 | class ExpressionEvaluation2Logic { | ||
18 | val extension LogicProblemBuilder builder = new LogicProblemBuilder | ||
19 | |||
20 | def Term transformCheck(XExpression expression, Map<PVariable, Variable> variable2Variable) { | ||
21 | return expression.transform(variable2Variable) | ||
22 | } | ||
23 | def Term transformEval(PVariable target, XExpression expression, Map<PVariable, Variable> variable2Variable) { | ||
24 | return target.lookup(variable2Variable) == expression.transform(variable2Variable) | ||
25 | } | ||
26 | |||
27 | static val N_Base = "org.eclipse.xtext.xbase.lib." | ||
28 | |||
29 | static val N_PLUS1 = "operator_plus" | ||
30 | static val N_MINUS1 = "operator_minus" | ||
31 | |||
32 | static val N_MINUS2 = "operator_minus" | ||
33 | static val N_PLUS2 = "operator_plus" | ||
34 | static val N_POWER = "operator_power" | ||
35 | static val N_MULTIPLY = "operator_multiply" | ||
36 | static val N_DIVIDE = "operator_divide" | ||
37 | static val N_MODULO = "operator_modulo" | ||
38 | static val N_LESSTHAN = "operator_lessThan" | ||
39 | static val N_LESSEQUALSTHAN = "operator_lessEqualsThan" | ||
40 | static val N_GREATERTHAN = "operator_greaterThan" | ||
41 | static val N_GREATEREQUALTHAN = "operator_greaterEqualsThan" | ||
42 | static val N_EQUALS = "operator_equals" | ||
43 | static val N_NOTEQUALS = "operator_notEquals" | ||
44 | static val N_EQUALS3 = "operator_tripleEquals" | ||
45 | static val N_NOTEQUALS3 = "operator_tripleNotEquals" | ||
46 | |||
47 | |||
48 | |||
49 | protected def isN(String name, String s) { | ||
50 | val res = name.startsWith(N_Base) && name.endsWith(s) | ||
51 | //println('''[«res»] «name» ?= «N_Base»*«s»''') | ||
52 | return res | ||
53 | } | ||
54 | |||
55 | static val N_POWER2 = "java.lang.Math.pow" | ||
56 | |||
57 | def protected dispatch Term transform(XBinaryOperation e, Map<PVariable, Variable> variable2Variable) { | ||
58 | val left = e.leftOperand.transform(variable2Variable) | ||
59 | val right = e.rightOperand.transform(variable2Variable) | ||
60 | val feature = e.feature.qualifiedName | ||
61 | if(feature.isN(N_MINUS2)) { return Minus(left,right) } | ||
62 | else if(feature.isN(N_PLUS2)) { return Plus(left,right) } | ||
63 | else if(feature.isN(N_POWER)) { return Pow(left,right) } | ||
64 | else if(feature.isN(N_MULTIPLY)) { return Multiply(left,right) } | ||
65 | else if(feature.isN(N_DIVIDE)) { return Divide(left,right) } | ||
66 | else if(feature.isN(N_MODULO)) { return Modulo(left,right) } | ||
67 | else if(feature.isN(N_LESSTHAN)) { return LessThan(left,right) } | ||
68 | else if(feature.isN(N_LESSEQUALSTHAN)) { return LessOrEqual(left,right) } | ||
69 | else if(feature.isN(N_GREATERTHAN)) { return MoreThan(left,right) } | ||
70 | else if(feature.isN(N_GREATEREQUALTHAN)) { return MoreOrEqual(left,right) } | ||
71 | else if(feature.isN(N_EQUALS)) { return Equals(left,right) } | ||
72 | else if(feature.isN(N_NOTEQUALS)) { return Distinct(left,right) } | ||
73 | else if(feature.isN(N_EQUALS3)) { return Equals(left,right) } | ||
74 | else if(feature.isN(N_NOTEQUALS3)) { return Distinct(left,right) } | ||
75 | else { | ||
76 | println("-> " + e.feature+","+e.class) | ||
77 | println("-> " + e.leftOperand) | ||
78 | println("-> " + e.rightOperand) | ||
79 | println("-> " + e.feature.qualifiedName) | ||
80 | throw new UnsupportedOperationException('''Unsupported binary operator feature: "«e.feature.class.simpleName»" - «e»''') | ||
81 | } | ||
82 | } | ||
83 | |||
84 | def protected dispatch Term transform(XUnaryOperation e, Map<PVariable, Variable> variable2Variable) { | ||
85 | val operand = e.operand.transform(variable2Variable) | ||
86 | val feature = e.feature.qualifiedName | ||
87 | if(feature.isN(N_MINUS1)) { return Minus(0.asTerm,operand)} | ||
88 | else if(feature.isN(N_PLUS1)) { return operand} | ||
89 | else{ | ||
90 | println("-> " + e.feature+","+e.class) | ||
91 | println("-> " + e.operand) | ||
92 | println("-> " + e.feature.qualifiedName) | ||
93 | throw new UnsupportedOperationException('''Unsupported unary operator feature: "«e.feature.class.simpleName»" - «e»''') | ||
94 | } | ||
95 | } | ||
96 | |||
97 | def protected dispatch Term transform(XMemberFeatureCall e, Map<PVariable, Variable> variable2Variable) { | ||
98 | val transformedArguments = e.actualArguments.map[transform(variable2Variable)] | ||
99 | val feature = e.feature.qualifiedName | ||
100 | if(feature == N_POWER2) { | ||
101 | return Pow(transformedArguments.get(0),transformedArguments.get(1)) | ||
102 | }else { | ||
103 | println(e.feature+","+e.class) | ||
104 | println(e.actualArguments.join(", ")) | ||
105 | println(e.feature.qualifiedName) | ||
106 | throw new UnsupportedOperationException('''Unsupported feature call: "«e.feature.qualifiedName»" - «e»''') | ||
107 | } | ||
108 | } | ||
109 | |||
110 | def protected dispatch Term transform(XFeatureCall e, Map<PVariable,Variable> variable2Variable) { | ||
111 | val featureName = e.feature.qualifiedName | ||
112 | val entryWithName = variable2Variable.entrySet.filter[it.key.name == featureName].head | ||
113 | if(entryWithName !== null) { | ||
114 | return entryWithName.value.toTerm | ||
115 | } else { | ||
116 | throw new IllegalArgumentException('''Feature call reference to unavailable variable "«featureName»"''') | ||
117 | } | ||
118 | } | ||
119 | |||
120 | def protected dispatch Term transform(XNumberLiteral l, Map<PVariable, Variable> variable2Variable) { | ||
121 | val s = l.value | ||
122 | try{ return Integer.parseInt(s).asTerm } catch(NumberFormatException e){} | ||
123 | try{ return Short.parseShort(s).asTerm } catch(NumberFormatException e){} | ||
124 | try{ return Double.parseDouble(s).asTerm } catch(NumberFormatException e){} | ||
125 | try{ return Float.parseFloat(s).asTerm } catch(NumberFormatException e){} | ||
126 | throw new UnsupportedOperationException('''Unsupported numeric type: "«s»"''') | ||
127 | } | ||
128 | |||
129 | def protected dispatch Term transform(XExpression e, Map<PVariable, Variable> variable2Variable) { | ||
130 | throw new UnsupportedOperationException('''Unsupported expression: "«e.class.simpleName»" - «e»''') | ||
131 | } | ||
132 | } \ No newline at end of file | ||
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2Logic.xtend b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2Logic.xtend index 3b828170..0f97d3fe 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2Logic.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2Logic.xtend | |||
@@ -4,48 +4,36 @@ import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | |||
4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace | 4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace |
5 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder | 5 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder |
6 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput | 6 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput |
7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.ComplexTypeReference | ||
8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.PrimitiveTypeReference | ||
9 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDefinition | 7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDefinition |
10 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type | ||
11 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeReference | ||
12 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Variable | 8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Variable |
13 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem | 9 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem |
14 | import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.TransfomedViatraQuery | 10 | import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.TransfomedViatraQuery |
15 | import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.Viatra2LogicAnnotationsFactory | 11 | import hu.bme.mit.inf.dslreasoner.viatra2logic.viatra2logicannotations.Viatra2LogicAnnotationsFactory |
16 | import java.util.ArrayList | 12 | import java.util.ArrayList |
17 | import java.util.HashMap | 13 | import java.util.HashMap |
18 | import java.util.HashSet | ||
19 | import java.util.LinkedList | 14 | import java.util.LinkedList |
20 | import java.util.List | 15 | import java.util.List |
21 | import java.util.Map | 16 | import java.util.Map |
22 | import java.util.Set | 17 | import java.util.Set |
23 | import org.eclipse.emf.ecore.EAttribute | 18 | import org.eclipse.emf.ecore.EAttribute |
24 | import org.eclipse.emf.ecore.EClassifier | ||
25 | import org.eclipse.emf.ecore.EEnum | ||
26 | import org.eclipse.emf.ecore.EReference | 19 | import org.eclipse.emf.ecore.EReference |
27 | import org.eclipse.emf.ecore.EStructuralFeature | 20 | import org.eclipse.emf.ecore.EStructuralFeature |
28 | import org.eclipse.emf.ecore.EcorePackage | 21 | import org.eclipse.emf.ecore.util.EcoreUtil |
29 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification | 22 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification |
30 | import org.eclipse.viatra.query.runtime.emf.EMFQueryMetaContext | 23 | import org.eclipse.viatra.query.runtime.emf.EMFQueryMetaContext |
31 | import org.eclipse.viatra.query.runtime.emf.types.BaseEMFTypeKey | ||
32 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey | ||
33 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey | ||
34 | import org.eclipse.viatra.query.runtime.matchers.context.IInputKey | ||
35 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey | ||
36 | import org.eclipse.viatra.query.runtime.matchers.planning.helpers.TypeHelper | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody | 24 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody |
25 | import org.eclipse.viatra.query.runtime.matchers.psystem.PConstraint | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable | 26 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable |
27 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall | 28 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall |
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PDisjunction | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter | 31 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter |
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery | 32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery |
42 | import org.eclipse.viatra.query.runtime.matchers.psystem.rewriters.PBodyNormalizer | 33 | import org.eclipse.viatra.query.runtime.matchers.psystem.rewriters.PBodyNormalizer |
43 | import org.eclipse.xtend.lib.annotations.Data | 34 | import org.eclipse.xtend.lib.annotations.Data |
44 | 35 | ||
45 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | 36 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* |
46 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PDisjunction | ||
47 | import org.eclipse.emf.ecore.util.EcoreUtil | ||
48 | import org.eclipse.viatra.query.runtime.emf.types.EClassUnscopedTransitiveInstancesKey | ||
49 | 37 | ||
50 | @Data class ViatraQuerySetDescriptor { | 38 | @Data class ViatraQuerySetDescriptor { |
51 | val List<? extends IQuerySpecification<?>> patterns | 39 | val List<? extends IQuerySpecification<?>> patterns |
@@ -57,24 +45,24 @@ class Viatra2LogicTrace { | |||
57 | public val Map<PQuery, RelationDefinition> query2Relation = new HashMap | 45 | public val Map<PQuery, RelationDefinition> query2Relation = new HashMap |
58 | public val Map<PQuery, TransfomedViatraQuery> query2Annotation = new HashMap | 46 | public val Map<PQuery, TransfomedViatraQuery> query2Annotation = new HashMap |
59 | public val Map<Pair<PQuery,PParameter>, Variable> parameter2Variable = new HashMap | 47 | public val Map<Pair<PQuery,PParameter>, Variable> parameter2Variable = new HashMap |
60 | //public val Map<PVariable, Variable> variable2Variable = new HashMap | ||
61 | } | 48 | } |
62 | class Viatra2LogicConfiguration { | 49 | class Viatra2LogicConfiguration { |
63 | public var normalize = true | 50 | public var normalize = true |
64 | public var transitiveClosureDepth = 3 | ||
65 | } | 51 | } |
66 | 52 | ||
67 | class Viatra2Logic { | 53 | class Viatra2Logic { |
68 | val extension LogicProblemBuilder builder = new LogicProblemBuilder | 54 | val extension LogicProblemBuilder builder = new LogicProblemBuilder |
69 | val extension Viatra2LogicAnnotationsFactory factory = Viatra2LogicAnnotationsFactory.eINSTANCE | 55 | val extension Viatra2LogicAnnotationsFactory factory = Viatra2LogicAnnotationsFactory.eINSTANCE |
70 | val normalizer = new PBodyNormalizer(EMFQueryMetaContext.DEFAULT) | 56 | val normalizer = new PBodyNormalizer(EMFQueryMetaContext.DEFAULT) |
57 | val Viatra2LogicTypeInferer typeInferer | ||
71 | 58 | ||
72 | val Ecore2Logic ecore2Logic | 59 | val Ecore2Logic ecore2Logic |
73 | Constraint2Logic constraint2Logic | 60 | Constraint2Logic constraint2Logic |
74 | 61 | ||
75 | new(Ecore2Logic ecore2Logic) { | 62 | new(Ecore2Logic ecore2Logic) { |
76 | this.ecore2Logic = ecore2Logic | 63 | this.ecore2Logic = ecore2Logic |
77 | constraint2Logic = new Constraint2Logic(ecore2Logic) | 64 | this.typeInferer = new Viatra2LogicTypeInferer(ecore2Logic) |
65 | this.constraint2Logic = new Constraint2Logic(ecore2Logic) | ||
78 | } | 66 | } |
79 | 67 | ||
80 | def TracedOutput<LogicProblem,Viatra2LogicTrace> transformQueries( | 68 | def TracedOutput<LogicProblem,Viatra2LogicTrace> transformQueries( |
@@ -82,65 +70,55 @@ class Viatra2Logic { | |||
82 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | 70 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, |
83 | Viatra2LogicConfiguration config) | 71 | Viatra2LogicConfiguration config) |
84 | { | 72 | { |
73 | // Create trace | ||
85 | val viatra2LogicTrace = new Viatra2LogicTrace | 74 | val viatra2LogicTrace = new Viatra2LogicTrace |
86 | val typeAlanysis = new HashMap | 75 | |
76 | // Translation works on PQueries. QuerySpecification -> PQuery. | ||
87 | val pQueries = queries.patterns.map[it.internalQueryRepresentation] | 77 | val pQueries = queries.patterns.map[it.internalQueryRepresentation] |
88 | 78 | ||
89 | for(query: pQueries) { | 79 | // If requested, the queries are normalized |
90 | val disjunction = normalizer.rewrite(query) | 80 | for(query: pQueries) { |
81 | val disjunction = normalizer.rewrite(query) | ||
91 | viatra2LogicTrace.query2Disjunction.put(query,disjunction) | 82 | viatra2LogicTrace.query2Disjunction.put(query,disjunction) |
92 | } | 83 | } |
93 | 84 | ||
94 | for(query: pQueries) { | 85 | // The types are calculated |
95 | val types = query.lookup(viatra2LogicTrace.query2Disjunction).bodies.toInvertedMap[ | 86 | val types = typeInferer.inferTypes(pQueries,ecore2LogicTrace,viatra2LogicTrace) |
96 | TypeHelper::inferUnaryTypesFor(it.uniqueVariables,it.constraints,EMFQueryMetaContext.DEFAULT) | ||
97 | ] | ||
98 | // for(m : types.values) { | ||
99 | // for(n: m.entrySet) { | ||
100 | // val variable = n.key | ||
101 | // println(''' - «variable.name»''') | ||
102 | // for(type : n.value) { | ||
103 | // println('''«variable.name» - «type»''') | ||
104 | // } | ||
105 | // } | ||
106 | // | ||
107 | // } | ||
108 | |||
109 | typeAlanysis.put(query,types) | ||
110 | } | ||
111 | 87 | ||
88 | // First, the signature of the queries are translated, ... | ||
112 | for(query: pQueries) { | 89 | for(query: pQueries) { |
113 | try { | 90 | try { |
114 | this.transformQueryHeader(query,query.lookup(typeAlanysis),ecore2LogicTrace,viatra2LogicTrace,config) | 91 | this.transformQueryHeader(query,types,ecore2LogicTrace,viatra2LogicTrace,config) |
115 | } catch(IllegalArgumentException e) { | 92 | } catch(IllegalArgumentException e) { |
116 | throw new IllegalArgumentException(''' | 93 | throw new IllegalArgumentException(''' |
117 | Unable to translate query "«query.fullyQualifiedName»". | 94 | Unable to translate query "«query.fullyQualifiedName»". |
118 | Reason: «e.class.simpleName», «e.message»''',e) | 95 | Reason: «e.class.simpleName», «e.message»''',e) |
119 | } | 96 | } |
120 | } | 97 | } |
98 | |||
99 | // ...then the bodies, ... | ||
121 | for(query: pQueries) { | 100 | for(query: pQueries) { |
122 | try { | 101 | try { |
123 | this.transformQuerySpecification(query,query.lookup(typeAlanysis),ecore2LogicTrace,viatra2LogicTrace,config) | 102 | this.transformQuerySpecification(query,types,ecore2LogicTrace,viatra2LogicTrace,config) |
124 | } catch (IllegalArgumentException e){ | 103 | } catch (IllegalArgumentException e){ |
125 | throw new IllegalArgumentException(''' | 104 | throw new IllegalArgumentException(''' |
126 | Unable to translate query "«query.fullyQualifiedName»". | 105 | Unable to translate query "«query.fullyQualifiedName»". |
127 | Reason: «e.class.simpleName», «e.message»''',e) | 106 | Reason: «e.class.simpleName», «e.message»''',e) |
128 | } | 107 | } |
129 | } | 108 | } |
130 | /*for(d : viatra2LogicTrace.query2Relation.values) { | ||
131 | checkDefinition(d) | ||
132 | }*/ | ||
133 | 109 | ||
110 | // ... and finally, the annotations. | ||
134 | transformQueryConstraints( | 111 | transformQueryConstraints( |
135 | queries.validationPatterns.map[internalQueryRepresentation], | 112 | queries.validationPatterns.map[internalQueryRepresentation], |
136 | queries.derivedFeatures, | 113 | queries.derivedFeatures, |
137 | ecore2LogicTrace,viatra2LogicTrace) | 114 | ecore2LogicTrace,viatra2LogicTrace) |
115 | |||
138 | return new TracedOutput(ecore2LogicTrace.output,viatra2LogicTrace) | 116 | return new TracedOutput(ecore2LogicTrace.output,viatra2LogicTrace) |
139 | } | 117 | } |
140 | 118 | ||
141 | def protected transformQueryHeader( | 119 | def protected transformQueryHeader( |
142 | PQuery pquery, | 120 | PQuery pquery, |
143 | Map<PBody, Map<PVariable, Set<IInputKey>>> types, | 121 | Viatra2LogicTypeResult types, |
144 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | 122 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, |
145 | Viatra2LogicTrace viatra2LogicTrace, | 123 | Viatra2LogicTrace viatra2LogicTrace, |
146 | Viatra2LogicConfiguration config) | 124 | Viatra2LogicConfiguration config) |
@@ -149,7 +127,7 @@ class Viatra2Logic { | |||
149 | val parameters = new ArrayList<Variable>(pquery.parameters.size) | 127 | val parameters = new ArrayList<Variable>(pquery.parameters.size) |
150 | for(vParam: pquery.parameters) { | 128 | for(vParam: pquery.parameters) { |
151 | val parameterName = '''parameter «vParam.name»''' | 129 | val parameterName = '''parameter «vParam.name»''' |
152 | val parameterType = getType(vParam,types,ecore2LogicTrace) | 130 | val parameterType = types.getType(pquery,vParam) |
153 | if(parameterType === null) { | 131 | if(parameterType === null) { |
154 | throw new AssertionError('''null type for parameter «vParam.name» in pattern «pquery.fullyQualifiedName»''') | 132 | throw new AssertionError('''null type for parameter «vParam.name» in pattern «pquery.fullyQualifiedName»''') |
155 | } | 133 | } |
@@ -175,7 +153,7 @@ class Viatra2Logic { | |||
175 | 153 | ||
176 | def protected transformQuerySpecification( | 154 | def protected transformQuerySpecification( |
177 | PQuery pquery, | 155 | PQuery pquery, |
178 | Map<PBody, Map<PVariable, Set<IInputKey>>> types, | 156 | Viatra2LogicTypeResult types, |
179 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | 157 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, |
180 | Viatra2LogicTrace viatra2LogicTrace, | 158 | Viatra2LogicTrace viatra2LogicTrace, |
181 | Viatra2LogicConfiguration config) | 159 | Viatra2LogicConfiguration config) |
@@ -233,7 +211,7 @@ class Viatra2Logic { | |||
233 | } | 211 | } |
234 | 212 | ||
235 | def transformBody(PBody body, | 213 | def transformBody(PBody body, |
236 | Map<PBody, Map<PVariable, Set<IInputKey>>> types, | 214 | Viatra2LogicTypeResult types, |
237 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | 215 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, |
238 | Viatra2LogicTrace viatra2LogicTrace, | 216 | Viatra2LogicTrace viatra2LogicTrace, |
239 | Viatra2LogicConfiguration config) | 217 | Viatra2LogicConfiguration config) |
@@ -248,19 +226,29 @@ class Viatra2Logic { | |||
248 | // Inner Variables | 226 | // Inner Variables |
249 | val innerPositiveVariables = new LinkedList | 227 | val innerPositiveVariables = new LinkedList |
250 | val innerNegativeVariables = new LinkedList | 228 | val innerNegativeVariables = new LinkedList |
229 | val innerAggreatedVariables = new LinkedList | ||
230 | //println(body.uniqueVariables) | ||
251 | for(innerVariable : body.uniqueVariables) { | 231 | for(innerVariable : body.uniqueVariables) { |
252 | 232 | ||
253 | if(!variable2Variable.containsKey(innerVariable)) { | 233 | if(!variable2Variable.containsKey(innerVariable)) { |
254 | val name = '''variable «innerVariable.name.normalizeName»''' | 234 | if(innerVariable.aggregateOnly) { |
255 | //println(body.pattern.fullyQualifiedName + "-") | 235 | // do not create variable |
256 | val logicType = getType(innerVariable,types,ecore2LogicTrace) | 236 | innerAggreatedVariables.add(innerVariable) |
257 | val logicVariable = createVar(name,logicType) | 237 | variable2Variable.put(innerVariable,null) |
258 | if(innerVariable.isPositiveVariable) { | ||
259 | innerPositiveVariables += logicVariable | ||
260 | } else { | 238 | } else { |
261 | innerNegativeVariables += logicVariable | 239 | val name = '''variable «innerVariable.name.normalizeName»''' |
240 | val logicType = types.getType(body,innerVariable) | ||
241 | if(logicType === null) { | ||
242 | throw new IllegalArgumentException('''Variable «innerVariable.name.normalizeName» has no type!''') | ||
243 | } | ||
244 | val logicVariable = createVar(name,logicType) | ||
245 | if(innerVariable.negativeOnly) { | ||
246 | innerNegativeVariables += logicVariable | ||
247 | } else { | ||
248 | innerPositiveVariables += logicVariable | ||
249 | } | ||
250 | variable2Variable.put(innerVariable,logicVariable) | ||
262 | } | 251 | } |
263 | variable2Variable.put(innerVariable,logicVariable) | ||
264 | } | 252 | } |
265 | } | 253 | } |
266 | 254 | ||
@@ -282,226 +270,36 @@ class Viatra2Logic { | |||
282 | 270 | ||
283 | return allVariablesAreExisting | 271 | return allVariablesAreExisting |
284 | } | 272 | } |
285 | // def toTypeJudgement(PVariable v, IInputKey key) { | ||
286 | // new TypeJudgement(key,new Tuple1) | ||
287 | // } | ||
288 | 273 | ||
289 | def private normalizeName(String variableName) { | 274 | def private normalizeName(String variableName) { |
290 | return variableName.replaceAll("[\\W]|_", "") | 275 | return variableName.replaceAll("[\\W]|_", "") |
291 | } | 276 | } |
292 | |||
293 | /** | ||
294 | * Translates the type of a parameter variable in a pattern | ||
295 | */ | ||
296 | def TypeReference getType(PParameter v, Map<PBody, Map<PVariable, Set<IInputKey>>> types, TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
297 | // If parameter type is specified then the specified type is used | ||
298 | if(v.declaredUnaryType !== null) { | ||
299 | val res = transformTypeReference(v.declaredUnaryType,ecore2LogicTrace) | ||
300 | if(res === null) { | ||
301 | throw new AssertionError(''' | ||
302 | Unable to translate declared type «v.declaredUnaryType». | ||
303 | ''') | ||
304 | } else { | ||
305 | return res | ||
306 | } | ||
307 | } | ||
308 | // Otherwise, calculate the type based on the type of the variable in the bodies | ||
309 | else { | ||
310 | val bodies = types.keySet | ||
311 | val typesFromBodies = new ArrayList(bodies.size) | ||
312 | for(body : bodies) { | ||
313 | // collect the variable in the body | ||
314 | val exported = body.symbolicParameters.filter[it.patternParameter === v] | ||
315 | if(exported.size !== 1) { | ||
316 | throw new AssertionError('''Parameter «v.name» has no reference in body!''') | ||
317 | } | ||
318 | val variable = exported.head.parameterVariable | ||
319 | typesFromBodies+=variable.getType(types,ecore2LogicTrace) | ||
320 | } | ||
321 | return typesFromBodies.calculateCommonSupertype | ||
322 | } | ||
323 | } | ||
324 | |||
325 | /** | ||
326 | * Translates the type of a variable in a pattern body | ||
327 | */ | ||
328 | def TypeReference getType(PVariable v, Map<PBody, Map<PVariable, Set<IInputKey>>> types ,TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
329 | if (v.isPositiveVariable) { | ||
330 | val keys = getTypesFromCollection(v,types) | ||
331 | val logicTypes = keys.map[transformTypeReference(it,ecore2LogicTrace)].filterNull | ||
332 | return logicTypes.calculateCommonSubtype | ||
333 | } else { | ||
334 | val onlyConstraint = v.referringConstraints.head as NegativePatternCall | ||
335 | val indexOfVariable = v.lookup(onlyConstraint.actualParametersTuple.invertIndex) | ||
336 | val parameter = onlyConstraint.referredQuery.parameters.get(indexOfVariable) | ||
337 | val declaredUnaryType = parameter.declaredUnaryType as BaseEMFTypeKey<? extends EClassifier> | ||
338 | if (declaredUnaryType === null) { | ||
339 | throw new UnsupportedOperationException( | ||
340 | '''parameter «parameter.name» in pattern «onlyConstraint.referredQuery.fullyQualifiedName» does not have type!''') | ||
341 | } else | ||
342 | return declaredUnaryType.transformTypeReference(ecore2LogicTrace) | ||
343 | } | ||
344 | } | ||
345 | |||
346 | def getTypesFromCollection(PVariable v, Map<PBody, Map<PVariable, Set<IInputKey>>> types) { | ||
347 | for(entry : types.entrySet) { | ||
348 | if(entry.key.uniqueVariables.contains(v)) { | ||
349 | return v.lookup(entry.value) | ||
350 | } | ||
351 | } | ||
352 | throw new IllegalArgumentException('''Variable «v.name» is not present in neither of the bodies!''') | ||
353 | } | ||
354 | |||
355 | 277 | ||
356 | def TypeReference calculateCommonSubtype(Iterable<TypeReference> types) { | 278 | def isNegativeOnly(PVariable variable) { |
357 | val primitiveTypeReferences = types.filter(PrimitiveTypeReference) | 279 | if(variable.referringConstraints.size == 1) { |
358 | val complexTypeReferences = types.filter(ComplexTypeReference) | 280 | val PConstraint onlyConstraint = variable.referringConstraints.head |
359 | if(complexTypeReferences.isEmpty) { | 281 | if(onlyConstraint instanceof NegativePatternCall) { |
360 | val head = primitiveTypeReferences.head | 282 | return true |
361 | if(primitiveTypeReferences.exists[it.eClass !== head.eClass]) { | 283 | } else { |
362 | throw new IllegalArgumentException('''Inconsistent types: «primitiveTypeReferences.map[eClass.name].toSet.toList»''') | 284 | return false |
363 | } | ||
364 | return head | ||
365 | } else if(primitiveTypeReferences.isEmpty) { | ||
366 | val complexTypes = complexTypeReferences.map[it.referred].toSet | ||
367 | if(complexTypes.size === 1) { | ||
368 | return builder.toTypeReference(complexTypes.head) | ||
369 | } | ||
370 | // Collect possible subtypes | ||
371 | val subtypeSets = complexTypes.map[it.transitiveClosureStar[it.subtypes].toSet] | ||
372 | val commonTypeSet = new HashSet(subtypeSets.head) | ||
373 | val otherSets = subtypeSets.tail | ||
374 | for(otherSet : otherSets) { | ||
375 | commonTypeSet.retainAll(otherSet) | ||
376 | } | ||
377 | if(commonTypeSet.empty) { | ||
378 | throw new IllegalArgumentException('''Inconsistent types: «complexTypes.map[name].toList»''') | ||
379 | } | ||
380 | |||
381 | return calculateCommonComplexSupertype(commonTypeSet) | ||
382 | |||
383 | } else { | ||
384 | throw new IllegalArgumentException(''' | ||
385 | Inconsistent types, mixing primitive and complex types: | ||
386 | «primitiveTypeReferences.map[eClass.name].toSet.toList» | ||
387 | and | ||
388 | «complexTypeReferences.map[it.referred].toSet.map[name].toList»''') | ||
389 | |||
390 | } | ||
391 | } | ||
392 | def TypeReference calculateCommonSupertype(Iterable<TypeReference> types) { | ||
393 | val primitiveTypeReferences = types.filter(PrimitiveTypeReference) | ||
394 | val complexTypeReferences = types.filter(ComplexTypeReference) | ||
395 | if(complexTypeReferences.isEmpty) { | ||
396 | val head = primitiveTypeReferences.head | ||
397 | if(primitiveTypeReferences.exists[it.eClass !== head.eClass]) { | ||
398 | throw new IllegalArgumentException('''Inconsistent types: «primitiveTypeReferences.map[eClass.name].toSet.toList»''') | ||
399 | } | ||
400 | return head | ||
401 | } else if(primitiveTypeReferences.isEmpty) { | ||
402 | val complexTypes = complexTypeReferences.map[it.referred].toSet | ||
403 | return calculateCommonComplexSupertype(complexTypes) | ||
404 | |||
405 | } else { | ||
406 | throw new IllegalArgumentException(''' | ||
407 | Inconsistent types, mixing primitive and complex types: | ||
408 | «primitiveTypeReferences.map[eClass.name].toSet.toList» | ||
409 | and | ||
410 | «complexTypeReferences.map[it.referred].toSet.map[name].toList»''') | ||
411 | |||
412 | } | ||
413 | } | ||
414 | def TypeReference calculateCommonComplexSupertype(Set<Type> complexTypes) { | ||
415 | if(complexTypes.size === 1) { | ||
416 | return builder.toTypeReference(complexTypes.head) | ||
417 | } | ||
418 | // Collect possible supertypes | ||
419 | val supertypeSets = complexTypes.map[it.transitiveClosureStar[it.supertypes].toSet] | ||
420 | val commonTypeSet = new HashSet(supertypeSets.head) | ||
421 | val otherSets = supertypeSets.tail | ||
422 | for(otherSet : otherSets) { | ||
423 | commonTypeSet.retainAll(otherSet) | ||
424 | } | ||
425 | if(commonTypeSet.empty) { | ||
426 | throw new IllegalArgumentException('''Inconsistent types: «complexTypes.map[name].toList»''') | ||
427 | } | ||
428 | // Remove type that already have covered | ||
429 | val coveredTypes = commonTypeSet.map[it.supertypes].flatten | ||
430 | commonTypeSet.removeAll(coveredTypes) | ||
431 | return builder.toTypeReference(commonTypeSet.head) | ||
432 | } | ||
433 | |||
434 | /** | ||
435 | * Transforms a Viatra type reference to a logic type. | ||
436 | */ | ||
437 | def dispatch TypeReference transformTypeReference(EDataTypeInSlotsKey k,TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
438 | val w = k.wrappedKey | ||
439 | if(w == EcorePackage.Literals.EINT || w == EcorePackage.Literals.ESHORT || w == EcorePackage.Literals.ELONG) { | ||
440 | return builder.LogicInt | ||
441 | } else if(w == EcorePackage.Literals.EDOUBLE || w == EcorePackage.Literals.EFLOAT) { | ||
442 | return builder.LogicReal | ||
443 | } else if(w == EcorePackage.Literals.EBOOLEAN) { | ||
444 | return builder.LogicBool | ||
445 | } else if(w == EcorePackage.Literals.ESTRING) { | ||
446 | return builder.LogicString | ||
447 | } else if(w instanceof EEnum) { | ||
448 | val c = this.ecore2Logic.TypeofEEnum(ecore2LogicTrace.trace,w) | ||
449 | return builder.toTypeReference(c); | ||
450 | } else throw new UnsupportedOperationException('''Unknown reference type «w.class.name»''') | ||
451 | } | ||
452 | def dispatch TypeReference transformTypeReference(JavaTransitiveInstancesKey k,TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
453 | val c = k.wrapperInstanceClass | ||
454 | if(c == Integer || c == Long || c == Short) { | ||
455 | return LogicInt | ||
456 | } else if(c == Float || c == Double) { | ||
457 | return LogicReal | ||
458 | } else if(c == Boolean) { | ||
459 | return LogicBool | ||
460 | } else if(c == String) { | ||
461 | return LogicString | ||
462 | } else if(c.superclass == java.lang.Enum){ | ||
463 | val enums = ecore2Logic.allEnumsInScope(ecore2LogicTrace.trace) | ||
464 | for(enum : enums) { | ||
465 | if(c == enum.instanceClass) { | ||
466 | return builder.toTypeReference(ecore2Logic.TypeofEEnum(ecore2LogicTrace.trace,enum)) | ||
467 | } | ||
468 | } | 285 | } |
469 | throw new IllegalArgumentException('''Enum type «c.simpleName» is not mapped to logic!''') | ||
470 | } | ||
471 | return null | ||
472 | } | ||
473 | def dispatch TypeReference transformTypeReference(EClassTransitiveInstancesKey k,TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
474 | val c = k.wrappedKey | ||
475 | |||
476 | if(this.ecore2Logic.allClassesInScope(ecore2LogicTrace.trace).toList.contains(c)) { | ||
477 | return builder.toTypeReference(this.ecore2Logic.TypeofEClass(ecore2LogicTrace.trace,k.wrappedKey)) | ||
478 | } else { | 286 | } else { |
479 | return null | 287 | return false |
480 | } | 288 | } |
481 | } | 289 | } |
482 | def dispatch TypeReference transformTypeReference(EClassUnscopedTransitiveInstancesKey k, TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
483 | val c = k.wrappedKey | ||
484 | |||
485 | if(this.ecore2Logic.allClassesInScope(ecore2LogicTrace.trace).toList.contains(c)) { | ||
486 | return builder.toTypeReference(this.ecore2Logic.TypeofEClass(ecore2LogicTrace.trace,k.wrappedKey)) | ||
487 | } else { | ||
488 | return null | ||
489 | } | ||
490 | } | ||
491 | |||
492 | def dispatch TypeReference transformTypeReference(IInputKey k,TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
493 | //println(k) | ||
494 | throw new IllegalArgumentException('''Unsupported type: «k.class.simpleName»''') | ||
495 | } | ||
496 | 290 | ||
497 | def boolean isPositiveVariable(PVariable v) { | 291 | def isAggregateOnly(PVariable variable) { |
498 | val constraints = v.referringConstraints | 292 | if(variable.referringConstraints.size == 1) { |
499 | if(constraints.size == 1) { | 293 | val PConstraint onlyConstraint = variable.referringConstraints.head |
500 | val onlyConstraint = constraints.head | 294 | if(onlyConstraint instanceof AggregatorConstraint) { |
501 | if(onlyConstraint instanceof NegativePatternCall) { | 295 | return true |
296 | } else if(onlyConstraint instanceof PatternMatchCounter) { | ||
297 | return true | ||
298 | } else { | ||
502 | return false | 299 | return false |
503 | } | 300 | } |
301 | } else { | ||
302 | return false | ||
504 | } | 303 | } |
505 | return true | ||
506 | } | 304 | } |
507 | } \ No newline at end of file | 305 | } \ No newline at end of file |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2LogicTypeInferer.xtend b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2LogicTypeInferer.xtend new file mode 100644 index 00000000..b8a6b9c1 --- /dev/null +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2LogicTypeInferer.xtend | |||
@@ -0,0 +1,392 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatra2logic | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic | ||
4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace | ||
5 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder | ||
6 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput | ||
7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.ComplexTypeReference | ||
8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntTypeReference | ||
9 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.PrimitiveTypeReference | ||
10 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealTypeReference | ||
11 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type | ||
12 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeReference | ||
13 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem | ||
14 | import java.util.HashMap | ||
15 | import java.util.HashSet | ||
16 | import java.util.List | ||
17 | import java.util.Set | ||
18 | import org.eclipse.emf.ecore.EEnum | ||
19 | import org.eclipse.emf.ecore.EcorePackage | ||
20 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup | ||
21 | import org.eclipse.viatra.query.patternlanguage.emf.specification.XBaseEvaluator | ||
22 | import org.eclipse.viatra.query.runtime.emf.EMFQueryMetaContext | ||
23 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey | ||
24 | import org.eclipse.viatra.query.runtime.emf.types.EClassUnscopedTransitiveInstancesKey | ||
25 | import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey | ||
26 | import org.eclipse.viatra.query.runtime.matchers.context.IInputKey | ||
27 | import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey | ||
28 | import org.eclipse.viatra.query.runtime.matchers.planning.helpers.TypeHelper | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternCallBasedDeferred | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery | ||
38 | import org.eclipse.xtext.xbase.XExpression | ||
39 | import org.eclipse.xtext.xbase.typesystem.IBatchTypeResolver | ||
40 | import org.eclipse.xtext.xbase.typesystem.references.UnknownTypeReference | ||
41 | |||
42 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | ||
43 | import org.eclipse.xtext.xbase.typesystem.references.InnerTypeReference | ||
44 | |||
45 | class Viatra2LogicTypeInferer{ | ||
46 | val Ecore2Logic ecore2Logic | ||
47 | val extension LogicProblemBuilder builder = new LogicProblemBuilder | ||
48 | /**Typeresolver uses the same resolver as EMFPatternLanguageStandaloneSetup.*/ | ||
49 | val IBatchTypeResolver typeResolver = | ||
50 | (new EMFPatternLanguageStandaloneSetup).createInjector.getInstance(IBatchTypeResolver) | ||
51 | val expressionExtractor = new XExpressionExtractor | ||
52 | |||
53 | new(Ecore2Logic ecore2Logic) { | ||
54 | this.ecore2Logic = ecore2Logic | ||
55 | } | ||
56 | |||
57 | def Viatra2LogicTypeResult inferTypes(List<PQuery> pQueries, TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, Viatra2LogicTrace viatra2LogicTrace) { | ||
58 | val Viatra2LogicTypeResult result = new Viatra2LogicTypeResult(new HashMap,new HashMap); | ||
59 | for(query : pQueries) { | ||
60 | for(body: query.lookup(viatra2LogicTrace.query2Disjunction).bodies) { | ||
61 | for(variable : body.uniqueVariables) { | ||
62 | getOrMakeTypeDecision(result,variable,body,ecore2LogicTrace,viatra2LogicTrace,emptySet) | ||
63 | } | ||
64 | } | ||
65 | for(parameter: query.parameters) { | ||
66 | getOrMakeTypeDecision(result,query,parameter,ecore2LogicTrace,viatra2LogicTrace,emptySet) | ||
67 | } | ||
68 | } | ||
69 | return result | ||
70 | } | ||
71 | |||
72 | private def TypeReference getOrMakeTypeDecision( | ||
73 | Viatra2LogicTypeResult result, | ||
74 | PVariable variable, PBody body, | ||
75 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | ||
76 | Viatra2LogicTrace viatra2LogicTrace, | ||
77 | Set<? extends PParameter> checkedInDecisionMaking) | ||
78 | { | ||
79 | if(result.containsSolution(body,variable)) { | ||
80 | return result.getType(body,variable) | ||
81 | } else { | ||
82 | val inferredTypesByViatra = TypeHelper::inferUnaryTypesFor(body.uniqueVariables, body.constraints, EMFQueryMetaContext.DEFAULT) | ||
83 | val constraintsForVariable = variable.lookup(inferredTypesByViatra) | ||
84 | |||
85 | val typeConstraintsDerivedByTypeHelper = constraintsForVariable.map[transformTypeReference(ecore2LogicTrace)] | ||
86 | val typesFromEval = variable.getTypesFromEval(typeResolver) | ||
87 | val typesFromAggregatorResult = variable.getTypeFromPassivePatternCallConstraintResult( | ||
88 | result, | ||
89 | ecore2LogicTrace, | ||
90 | viatra2LogicTrace, | ||
91 | checkedInDecisionMaking) | ||
92 | |||
93 | val typesFromPositiveReasoning = (typeConstraintsDerivedByTypeHelper + typesFromEval + typesFromAggregatorResult).filterNull | ||
94 | |||
95 | val types = if(!typesFromPositiveReasoning.empty) { | ||
96 | typesFromPositiveReasoning | ||
97 | } else { | ||
98 | variable.getTypeFromPassivePatternCallConstraints( | ||
99 | result, | ||
100 | ecore2LogicTrace, | ||
101 | viatra2LogicTrace, | ||
102 | checkedInDecisionMaking) | ||
103 | } | ||
104 | |||
105 | val commonSubtype = this.calculateCommonSubtype(types) | ||
106 | |||
107 | result.addType(body,variable,commonSubtype) | ||
108 | return commonSubtype | ||
109 | } | ||
110 | } | ||
111 | |||
112 | private def TypeReference getOrMakeTypeDecision( | ||
113 | Viatra2LogicTypeResult result, | ||
114 | PQuery query, | ||
115 | PParameter parameter, | ||
116 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | ||
117 | Viatra2LogicTrace viatra2LogicTrace, | ||
118 | Set<? extends PParameter> checkedInDecisionMaking) | ||
119 | { | ||
120 | if(checkedInDecisionMaking.contains(parameter)) { | ||
121 | return null | ||
122 | } | ||
123 | if(result.containsSolution(parameter)) { | ||
124 | return result.getType(query, parameter) | ||
125 | } | ||
126 | |||
127 | var TypeReference typeReference; | ||
128 | |||
129 | if(parameter.declaredUnaryType !== null) { | ||
130 | val key = parameter.declaredUnaryType | ||
131 | typeReference = key.transformTypeReference(ecore2LogicTrace) | ||
132 | } else { | ||
133 | val bodies = query.lookup(viatra2LogicTrace.query2Disjunction).bodies | ||
134 | val newChecked = new HashSet(checkedInDecisionMaking) => [add(parameter)] | ||
135 | val Iterable<TypeReference> variableTypes = bodies.map[body| | ||
136 | val symbolicParameter = body.symbolicParameters.filter[patternParameter === parameter].head | ||
137 | val variable = symbolicParameter.parameterVariable | ||
138 | getOrMakeTypeDecision(result,variable,body,ecore2LogicTrace,viatra2LogicTrace,newChecked) | ||
139 | ] | ||
140 | typeReference = calculateCommonSupertype(variableTypes) | ||
141 | } | ||
142 | result.addType(query,parameter,typeReference) | ||
143 | return typeReference | ||
144 | } | ||
145 | |||
146 | private def Iterable<? extends TypeReference> getTypesFromEval(PVariable v, IBatchTypeResolver typeResolver) { | ||
147 | val constraints = v.getReferringConstraintsOfType( | ||
148 | typeof(ExpressionEvaluation) | ||
149 | ).filter[ | ||
150 | it.outputVariable === v | ||
151 | ] | ||
152 | val res = constraints.map[getTypeFromEval] | ||
153 | return res | ||
154 | } | ||
155 | |||
156 | def TypeReference getTypeFromEval(ExpressionEvaluation evaluation) { | ||
157 | val XExpression expression = expressionExtractor.extractExpression(evaluation.evaluator) | ||
158 | val returnType = typeResolver.resolveTypes(expression).getReturnType(expression); | ||
159 | if(returnType === null || returnType instanceof UnknownTypeReference) { | ||
160 | return null | ||
161 | } else { | ||
162 | val javaIdentifier = returnType.wrapperTypeIfPrimitive.javaIdentifier | ||
163 | if(javaIdentifier == Boolean.name) { | ||
164 | return LogicBool | ||
165 | } else if(javaIdentifier == Integer.name || javaIdentifier == Short.name) { | ||
166 | return LogicInt | ||
167 | } else if(javaIdentifier == Double.name || javaIdentifier == Float.name){ | ||
168 | return LogicReal | ||
169 | } else if(javaIdentifier == String.name) { | ||
170 | return LogicString | ||
171 | } else { | ||
172 | throw new UnsupportedOperationException('''Unsupported eval type: "«javaIdentifier»"!''') | ||
173 | } | ||
174 | } | ||
175 | } | ||
176 | |||
177 | private def getTypeFromPassivePatternCallConstraintResult( | ||
178 | PVariable v, | ||
179 | Viatra2LogicTypeResult result, | ||
180 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | ||
181 | Viatra2LogicTrace viatra2LogicTrace, | ||
182 | Set<? extends PParameter> checkedInDecisionMaking | ||
183 | ) { | ||
184 | val referringConstraints = v.referringConstraints | ||
185 | |||
186 | val referringCountMatcherTargeting = referringConstraints | ||
187 | .filter(PatternMatchCounter) | ||
188 | .filter[it.resultVariable === v] | ||
189 | .map[builder.LogicInt] | ||
190 | val referringAggregatorConstraintsTargeting = referringConstraints | ||
191 | .filter(AggregatorConstraint) | ||
192 | .filter[it.resultVariable === v] | ||
193 | .map[ // get the type of the referred column | ||
194 | getOrMakeTypeDecision( | ||
195 | result, | ||
196 | it.referredQuery, | ||
197 | it.referredQuery.parameters.get(aggregatedColumn), | ||
198 | ecore2LogicTrace, | ||
199 | viatra2LogicTrace, | ||
200 | checkedInDecisionMaking)] | ||
201 | |||
202 | return referringCountMatcherTargeting + referringAggregatorConstraintsTargeting | ||
203 | } | ||
204 | |||
205 | private def getTypeFromPassivePatternCallConstraints( | ||
206 | PVariable v, | ||
207 | Viatra2LogicTypeResult result, | ||
208 | TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, | ||
209 | Viatra2LogicTrace viatra2LogicTrace, | ||
210 | Set<? extends PParameter> checkedInDecisionMaking | ||
211 | ) { | ||
212 | val referringConstraints = v.referringConstraints | ||
213 | if(referringConstraints.size === 1) { | ||
214 | val onlyConstraint = referringConstraints.head | ||
215 | |||
216 | if(onlyConstraint instanceof PatternCallBasedDeferred) { | ||
217 | val indexOfVariable = v.lookup(onlyConstraint.actualParametersTuple.invertIndex) | ||
218 | val parameter = onlyConstraint.referredQuery.parameters.get(indexOfVariable) | ||
219 | val res = getOrMakeTypeDecision(result, onlyConstraint.referredQuery, parameter, ecore2LogicTrace,viatra2LogicTrace,checkedInDecisionMaking) | ||
220 | return #[res] | ||
221 | } else { | ||
222 | throw new IllegalArgumentException('''A non-PatternCallBasedDeferred type constraint is referring to the variable "«v.name»"!''') | ||
223 | } | ||
224 | } else { | ||
225 | throw new IllegalArgumentException('''Multiple («referringConstraints.size», «FOR c:referringConstraints SEPARATOR ", "»«c»«ENDFOR») constraints are referring to variable "«v.name»", but no type is inferred!''') | ||
226 | } | ||
227 | } | ||
228 | |||
229 | def TypeReference calculateCommonSubtype(Iterable<TypeReference> types) { | ||
230 | val primitiveTypeReferences = types.filter(PrimitiveTypeReference) | ||
231 | val complexTypeReferences = types.filter(ComplexTypeReference) | ||
232 | if(complexTypeReferences.isEmpty) { | ||
233 | // If there is an int type, ... | ||
234 | if(primitiveTypeReferences.exists[it instanceof IntTypeReference]) { | ||
235 | // ... and all types are either real or int, then return int! | ||
236 | if(primitiveTypeReferences.forall[it instanceof RealTypeReference || it instanceof IntTypeReference]) { | ||
237 | return primitiveTypeReferences.filter(IntTypeReference).head | ||
238 | } | ||
239 | // Otherwise, the types are inconsistent, because they mixing numeric and non-numeric types. | ||
240 | else throw new IllegalArgumentException('''Inconsistent types: «primitiveTypeReferences.map[eClass.name].toSet.toList»''') | ||
241 | } | ||
242 | // If there is no Real, then the types should be homogenious | ||
243 | val head = primitiveTypeReferences.head | ||
244 | if(primitiveTypeReferences.exists[it.eClass !== head.eClass]) { | ||
245 | throw new IllegalArgumentException('''Inconsistent types: «primitiveTypeReferences.map[eClass.name].toSet.toList»''') | ||
246 | } | ||
247 | return head | ||
248 | } else if(primitiveTypeReferences.isEmpty) { | ||
249 | val complexTypes = complexTypeReferences.map[it.referred].toSet | ||
250 | if(complexTypes.size === 1) { | ||
251 | return builder.toTypeReference(complexTypes.head) | ||
252 | } | ||
253 | // Collect possible subtypes | ||
254 | val subtypeSets = complexTypes.map[it.transitiveClosureStar[it.subtypes].toSet] | ||
255 | val commonTypeSet = new HashSet(subtypeSets.head) | ||
256 | val otherSets = subtypeSets.tail | ||
257 | for(otherSet : otherSets) { | ||
258 | commonTypeSet.retainAll(otherSet) | ||
259 | } | ||
260 | if(commonTypeSet.empty) { | ||
261 | throw new IllegalArgumentException('''Inconsistent types: «complexTypes.map[name].toList»''') | ||
262 | } | ||
263 | |||
264 | |||
265 | return calculateCommonComplexSupertype(commonTypeSet) | ||
266 | |||
267 | } else { | ||
268 | throw new IllegalArgumentException(''' | ||
269 | Inconsistent types, mixing primitive and complex types: | ||
270 | «primitiveTypeReferences.map[eClass.name].toSet.toList» | ||
271 | and | ||
272 | «complexTypeReferences.map[it.referred].toSet.map[name].toList»''') | ||
273 | |||
274 | } | ||
275 | } | ||
276 | |||
277 | |||
278 | def TypeReference calculateCommonSupertype(Iterable<TypeReference> types) { | ||
279 | val primitiveTypeReferences = types.filter(PrimitiveTypeReference) | ||
280 | val complexTypeReferences = types.filter(ComplexTypeReference) | ||
281 | if(complexTypeReferences.isEmpty) { | ||
282 | // If there is a real type, ... | ||
283 | if(primitiveTypeReferences.exists[it instanceof RealTypeReference]) { | ||
284 | // ... and all types are either real or int, then return real! | ||
285 | if(primitiveTypeReferences.forall[it instanceof RealTypeReference || it instanceof IntTypeReference]) { | ||
286 | return primitiveTypeReferences.filter(RealTypeReference).head | ||
287 | } | ||
288 | // Otherwise, the types are inconsistent, because they mixing numeric and non-numeric types. | ||
289 | else throw new IllegalArgumentException('''Inconsistent types: «primitiveTypeReferences.map[eClass.name].toSet.toList»''') | ||
290 | } | ||
291 | // If there is no Real, then the types should be homogenious | ||
292 | val head = primitiveTypeReferences.head | ||
293 | if(primitiveTypeReferences.exists[it.eClass !== head.eClass]) { | ||
294 | throw new IllegalArgumentException('''Inconsistent types: «primitiveTypeReferences.map[eClass.name].toSet.toList»''') | ||
295 | } | ||
296 | return head | ||
297 | } else if(primitiveTypeReferences.isEmpty) { | ||
298 | val complexTypes = complexTypeReferences.map[it.referred].toSet | ||
299 | return calculateCommonComplexSupertype(complexTypes) | ||
300 | |||
301 | } else { | ||
302 | throw new IllegalArgumentException(''' | ||
303 | Inconsistent types, mixing primitive and complex types: | ||
304 | «primitiveTypeReferences.map[eClass.name].toSet.toList» | ||
305 | and | ||
306 | «complexTypeReferences.map[it.referred].toSet.map[name].toList»''') | ||
307 | |||
308 | } | ||
309 | } | ||
310 | def TypeReference calculateCommonComplexSupertype(Set<Type> complexTypes) { | ||
311 | if(complexTypes.size === 1) { | ||
312 | return builder.toTypeReference(complexTypes.head) | ||
313 | } | ||
314 | // Collect possible supertypes | ||
315 | val supertypeSets = complexTypes.map[it.transitiveClosureStar[it.supertypes].toSet] | ||
316 | val commonTypeSet = new HashSet(supertypeSets.head) | ||
317 | val otherSets = supertypeSets.tail | ||
318 | for(otherSet : otherSets) { | ||
319 | commonTypeSet.retainAll(otherSet) | ||
320 | } | ||
321 | if(commonTypeSet.empty) { | ||
322 | throw new IllegalArgumentException('''Inconsistent types: «complexTypes.map[name].toList»''') | ||
323 | } | ||
324 | // Remove type that already have covered | ||
325 | val coveredTypes = commonTypeSet.map[it.supertypes].flatten | ||
326 | commonTypeSet.removeAll(coveredTypes) | ||
327 | return builder.toTypeReference(commonTypeSet.head) | ||
328 | } | ||
329 | |||
330 | /** | ||
331 | * Transforms a Viatra type reference to a logic type. | ||
332 | */ | ||
333 | def dispatch TypeReference transformTypeReference(EDataTypeInSlotsKey k,TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
334 | val w = k.wrappedKey | ||
335 | if(w == EcorePackage.Literals.EINT || w == EcorePackage.Literals.ESHORT || w == EcorePackage.Literals.ELONG) { | ||
336 | return builder.LogicInt | ||
337 | } else if(w == EcorePackage.Literals.EDOUBLE || w == EcorePackage.Literals.EFLOAT) { | ||
338 | return builder.LogicReal | ||
339 | } else if(w == EcorePackage.Literals.EBOOLEAN) { | ||
340 | return builder.LogicBool | ||
341 | } else if(w == EcorePackage.Literals.ESTRING) { | ||
342 | return builder.LogicString | ||
343 | } else if(w instanceof EEnum) { | ||
344 | val c = this.ecore2Logic.TypeofEEnum(ecore2LogicTrace.trace,w) | ||
345 | return builder.toTypeReference(c); | ||
346 | } else throw new UnsupportedOperationException('''Unknown reference type «w.class.name»''') | ||
347 | } | ||
348 | def dispatch TypeReference transformTypeReference(JavaTransitiveInstancesKey k,TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
349 | val c = k.wrapperInstanceClass | ||
350 | if(c == Integer || c == Long || c == Short) { | ||
351 | return LogicInt | ||
352 | } else if(c == Float || c == Double) { | ||
353 | return LogicReal | ||
354 | } else if(c == Boolean) { | ||
355 | return LogicBool | ||
356 | } else if(c == String) { | ||
357 | return LogicString | ||
358 | } else if(c.superclass == Enum){ | ||
359 | val enums = ecore2Logic.allEnumsInScope(ecore2LogicTrace.trace) | ||
360 | for(enum : enums) { | ||
361 | if(c == enum.instanceClass) { | ||
362 | return builder.toTypeReference(ecore2Logic.TypeofEEnum(ecore2LogicTrace.trace,enum)) | ||
363 | } | ||
364 | } | ||
365 | throw new IllegalArgumentException('''Enum type «c.simpleName» is not mapped to logic!''') | ||
366 | } else { | ||
367 | return null | ||
368 | } | ||
369 | } | ||
370 | def dispatch TypeReference transformTypeReference(EClassTransitiveInstancesKey k,TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
371 | val c = k.wrappedKey | ||
372 | |||
373 | if(this.ecore2Logic.allClassesInScope(ecore2LogicTrace.trace).toList.contains(c)) { | ||
374 | return builder.toTypeReference(this.ecore2Logic.TypeofEClass(ecore2LogicTrace.trace,k.wrappedKey)) | ||
375 | } else { | ||
376 | return null | ||
377 | } | ||
378 | } | ||
379 | def dispatch TypeReference transformTypeReference(EClassUnscopedTransitiveInstancesKey k, TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
380 | val c = k.wrappedKey | ||
381 | |||
382 | if(this.ecore2Logic.allClassesInScope(ecore2LogicTrace.trace).toList.contains(c)) { | ||
383 | return builder.toTypeReference(this.ecore2Logic.TypeofEClass(ecore2LogicTrace.trace,k.wrappedKey)) | ||
384 | } else { | ||
385 | return null | ||
386 | } | ||
387 | } | ||
388 | |||
389 | def dispatch TypeReference transformTypeReference(IInputKey k,TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { | ||
390 | throw new IllegalArgumentException('''Unsupported type: «k.class.simpleName»''') | ||
391 | } | ||
392 | } \ No newline at end of file | ||
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2LogicTypeResult.xtend b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2LogicTypeResult.xtend new file mode 100644 index 00000000..7ba90724 --- /dev/null +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2LogicTypeResult.xtend | |||
@@ -0,0 +1,47 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatra2logic | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeReference | ||
4 | import java.util.Map | ||
5 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody | ||
6 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable | ||
7 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter | ||
8 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery | ||
9 | import org.eclipse.xtend.lib.annotations.Data | ||
10 | import org.eclipse.xtext.xbase.lib.Functions.Function0 | ||
11 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | ||
12 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.ComplexTypeReference | ||
13 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguageFactory | ||
14 | import org.eclipse.emf.ecore.util.EcoreUtil | ||
15 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.PrimitiveTypeReference | ||
16 | |||
17 | @Data class Viatra2LogicTypeResult{ | ||
18 | Map<Pair<PQuery,PParameter>,Function0<TypeReference>> typesInParameters | ||
19 | Map<Pair<PBody,PVariable>,Function0<TypeReference>> typesInBodies; | ||
20 | |||
21 | def addType(PBody body, PVariable variable, TypeReference typeConstructor) { | ||
22 | typesInBodies.put(body->variable,typeConstructor.createTypeConstructor) | ||
23 | } | ||
24 | def addType(PQuery query, PParameter variable, TypeReference typeConstructor) { | ||
25 | typesInParameters.put(query->variable,typeConstructor.createTypeConstructor) | ||
26 | } | ||
27 | def getType(PBody body, PVariable variable) { | ||
28 | return (body->variable).lookup(typesInBodies).apply | ||
29 | } | ||
30 | def getType(PQuery query, PParameter variable) { | ||
31 | return (query->variable).lookup(typesInParameters).apply | ||
32 | } | ||
33 | |||
34 | def containsSolution(PBody body, PVariable variable) { | ||
35 | return typesInBodies.containsKey(body->variable) | ||
36 | } | ||
37 | def containsSolution(PParameter variable) { | ||
38 | return typesInParameters.containsKey(variable) | ||
39 | } | ||
40 | |||
41 | def dispatch Function0<TypeReference> createTypeConstructor(ComplexTypeReference ref) { | ||
42 | return [LogiclanguageFactory.eINSTANCE.createComplexTypeReference=>[it.referred = ref.referred]] | ||
43 | } | ||
44 | def dispatch Function0<TypeReference> createTypeConstructor(PrimitiveTypeReference ref) { | ||
45 | return [EcoreUtil.copy(ref)] | ||
46 | } | ||
47 | } \ No newline at end of file | ||
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/XExpressionExtractor.xtend b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/XExpressionExtractor.xtend new file mode 100644 index 00000000..ea8d0b23 --- /dev/null +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/XExpressionExtractor.xtend | |||
@@ -0,0 +1,24 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatra2logic | ||
2 | |||
3 | import org.eclipse.viatra.query.patternlanguage.emf.specification.XBaseEvaluator | ||
4 | import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator | ||
5 | import org.eclipse.xtext.xbase.XExpression | ||
6 | |||
7 | class XExpressionExtractor { | ||
8 | def dispatch XExpression extractExpression(XBaseEvaluator evaluator) { evaluator.expression } | ||
9 | def dispatch XExpression extractExpression(IExpressionEvaluator evaluator) { | ||
10 | val clazz = evaluator.class | ||
11 | if(clazz.name == "org.eclipse.viatra.query.runtime.matchers.psystem.rewriters.VariableMappingExpressionEvaluatorWrapper") { | ||
12 | val field = clazz.declaredFields.filter[it.name == "wrapped"].head | ||
13 | if(field === null) { | ||
14 | throw new IllegalArgumentException('''Class «clazz.simpleName» has no field "wrapped"!''') | ||
15 | } else { | ||
16 | field.setAccessible(true); | ||
17 | val wrappedEvaluator = field.get(evaluator) as XBaseEvaluator | ||
18 | return wrappedEvaluator.extractExpression | ||
19 | } | ||
20 | } else { | ||
21 | throw new IllegalArgumentException('''Unsupported expression evaluation form: «clazz.simpleName»!''') | ||
22 | } | ||
23 | } | ||
24 | } \ No newline at end of file | ||
diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/lib/alloy4.2_2015-02-22.jar_GoesHere.txt b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/lib/alloy4.2_2015-02-22.jar_GoesHere.txt index 0df6fddc..960aa5d8 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/lib/alloy4.2_2015-02-22.jar_GoesHere.txt +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/lib/alloy4.2_2015-02-22.jar_GoesHere.txt | |||
@@ -1 +1 @@ | |||
Download alloy4.2_2015-02-22.jar from http://alloy.mit.edu/alloy/downloads/alloy4.2_2015-02-22.jar and place here. \ No newline at end of file | Download alloy4.2_2015-02-22.jar from http://alloytools.org/download/alloy4.2_2015-02-22.jar and place here. \ No newline at end of file | ||
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend index 54b0f54a..a0382e8e 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend | |||
@@ -131,12 +131,10 @@ abstract class PartialInterpretation2NeighbourhoodRepresentation<ModelRepresenta | |||
131 | } | 131 | } |
132 | newAdded = newAdded || (newElementNeigbours.size > elementNeigbours.size) | 132 | newAdded = newAdded || (newElementNeigbours.size > elementNeigbours.size) |
133 | } | 133 | } |
134 | |||
135 | width += 1 | 134 | width += 1 |
136 | } while (newAdded) | 135 | } while (newAdded) |
137 | return width | 136 | return width |
138 | } | 137 | } |
139 | |||
140 | /** | 138 | /** |
141 | * Creates a neighbourhood representation with traces | 139 | * Creates a neighbourhood representation with traces |
142 | * @param model The model to be represented. | 140 | * @param model The model to be represented. |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.visualisation/META-INF/MANIFEST.MF b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.visualisation/META-INF/MANIFEST.MF index 2abc6d50..754ff55d 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.visualisation/META-INF/MANIFEST.MF +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.visualisation/META-INF/MANIFEST.MF | |||
@@ -27,8 +27,7 @@ Require-Bundle: com.google.guava, | |||
27 | org.apache.batik.util.gui;bundle-version="[1.6.0,1.6.1]", | 27 | org.apache.batik.util.gui;bundle-version="[1.6.0,1.6.1]", |
28 | org.apache.xerces;bundle-version="2.9.0", | 28 | org.apache.xerces;bundle-version="2.9.0", |
29 | org.w3c.dom.svg;bundle-version="1.1.0", | 29 | org.w3c.dom.svg;bundle-version="1.1.0", |
30 | org.w3c.css.sac;bundle-version="1.3.1", | 30 | org.w3c.css.sac;bundle-version="1.3.1" |
31 | org.eclipse.m2e.maven.runtime.slf4j.simple;bundle-version="1.10.0" | ||
32 | Import-Package: com.eclipsesource.v8;version="4.6.0", | 31 | Import-Package: com.eclipsesource.v8;version="4.6.0", |
33 | com.eclipsesource.v8.debug;version="4.6.0", | 32 | com.eclipsesource.v8.debug;version="4.6.0", |
34 | com.eclipsesource.v8.utils;version="4.6.0", | 33 | com.eclipsesource.v8.utils;version="4.6.0", |