aboutsummaryrefslogtreecommitdiffstats
path: root/Framework
diff options
context:
space:
mode:
authorLibravatar OszkarSemerath <oszkar.semerath@gmail.com>2018-03-24 21:44:49 -0400
committerLibravatar OszkarSemerath <oszkar.semerath@gmail.com>2018-03-24 21:44:49 -0400
commitf42954a45bea9f3e40090447804f33f12c080640 (patch)
tree1c57d4ca595bf7825460c6aa080f93ea04d5689c /Framework
parentFactory for string literals. (diff)
downloadVIATRA-Generator-f42954a45bea9f3e40090447804f33f12c080640.tar.gz
VIATRA-Generator-f42954a45bea9f3e40090447804f33f12c080640.tar.zst
VIATRA-Generator-f42954a45bea9f3e40090447804f33f12c080640.zip
upgraded attribute support for the graph solver
Diffstat (limited to 'Framework')
-rw-r--r--Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Constraint2Logic.xtend32
-rw-r--r--Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/Viatra2Logic.xtend22
2 files changed, 48 insertions, 6 deletions
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 e83b81e6..3d2c46a5 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
@@ -129,6 +129,38 @@ class Constraint2Logic {
129 { 129 {
130 return value.asTerm 130 return value.asTerm
131 } 131 }
132 private def dispatch transformConstantValue(
133 Boolean value,
134 TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace,
135 Viatra2LogicTrace viatra2LogicTrace,
136 Viatra2LogicConfiguration config)
137 {
138 return value.asTerm
139 }
140 private def dispatch transformConstantValue(
141 String value,
142 TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace,
143 Viatra2LogicTrace viatra2LogicTrace,
144 Viatra2LogicConfiguration config)
145 {
146 return value.asTerm
147 }
148 private def dispatch transformConstantValue(
149 Double value,
150 TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace,
151 Viatra2LogicTrace viatra2LogicTrace,
152 Viatra2LogicConfiguration config)
153 {
154 return value.asTerm
155 }
156 private def dispatch transformConstantValue(
157 Float value,
158 TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace,
159 Viatra2LogicTrace viatra2LogicTrace,
160 Viatra2LogicConfiguration config)
161 {
162 return value.asTerm
163 }
132 private def dispatch transformConstantValue(Object other, 164 private def dispatch transformConstantValue(Object other,
133 TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace, 165 TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace,
134 Viatra2LogicTrace viatra2LogicTrace, 166 Viatra2LogicTrace viatra2LogicTrace,
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 d0c57db1..42c93da1 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
@@ -105,13 +105,15 @@ class Viatra2Logic {
105 val relationName = '''pattern «pquery.fullyQualifiedName.replace('.',' ')»''' 105 val relationName = '''pattern «pquery.fullyQualifiedName.replace('.',' ')»'''
106 val parameters = new ArrayList<Variable>(pquery.parameters.size) 106 val parameters = new ArrayList<Variable>(pquery.parameters.size)
107 for(vParam: pquery.parameters) { 107 for(vParam: pquery.parameters) {
108 //println(">" + vParam.declaredUnaryType)
109 val type = vParam.declaredUnaryType as BaseEMFTypeKey<? extends EClassifier>
108 val parameterType = transformTypeReference( 110 val parameterType = transformTypeReference(
109 vParam.declaredUnaryType as BaseEMFTypeKey<? extends EClassifier>, 111 type,
110 ecore2LogicTrace 112 ecore2LogicTrace
111 ) 113 )
112 if(parameterType == null) { 114// if(parameterType == null) {
113 println(parameterType) 115// println(parameterType)
114 } 116// }
115 val parameterName = '''parameter «vParam.name»''' 117 val parameterName = '''parameter «vParam.name»'''
116 val lParam = createVar(parameterName,parameterType) 118 val lParam = createVar(parameterName,parameterType)
117 viatra2LogicTrace.parameter2Variable.put(pquery->vParam,lParam) 119 viatra2LogicTrace.parameter2Variable.put(pquery->vParam,lParam)
@@ -252,13 +254,21 @@ class Viatra2Logic {
252 254
253 def TypeDescriptor getType(PVariable v, PBody body, TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) { 255 def TypeDescriptor getType(PVariable v, PBody body, TracedOutput<LogicProblem, Ecore2Logic_Trace> ecore2LogicTrace) {
254 if(v.isPositiveVariable) { 256 if(v.isPositiveVariable) {
255 val types = v.lookup( 257 val allTypes = v.lookup(
256 body.getAllUnaryTypeRestrictions(EMFQueryMetaContext.INSTANCE)) 258 body.getAllUnaryTypeRestrictions(EMFQueryMetaContext.INSTANCE))
259 val types = allTypes.filter[it.inputKey instanceof BaseEMFTypeKey<?>].toSet
260
257 if(types.size == 0) { 261 if(types.size == 0) {
258 throw new AssertionError('''No type for «v.name»''') 262 throw new AssertionError('''
263 No EMF type for «v.name».
264 Non-EMF types: [«FOR t : allTypes.filter[!types.contains(it)].map[inputKey.prettyPrintableName] SEPARATOR ','»«t»«ENDFOR»]''')
259 } else if(types.size == 1){ 265 } else if(types.size == 1){
260 return (types.head.inputKey as BaseEMFTypeKey<? extends EClassifier>).transformTypeReference(ecore2LogicTrace) 266 return (types.head.inputKey as BaseEMFTypeKey<? extends EClassifier>).transformTypeReference(ecore2LogicTrace)
261 } else { 267 } else {
268// println('''
269// Type Judgements of «v.name»
270// «types.map[inputKey.prettyPrintableName]»
271// ''')
262 return this.ecore2Logic.TypeofEClass(ecore2LogicTrace.trace, 272 return this.ecore2Logic.TypeofEClass(ecore2LogicTrace.trace,
263 calculateCommonSubtype(types.map[ 273 calculateCommonSubtype(types.map[
264 (it.inputKey as BaseEMFTypeKey<EClass>).emfKey as EClass 274 (it.inputKey as BaseEMFTypeKey<EClass>).emfKey as EClass