-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
419 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><plugin> | ||
<extension id="hu.bme.mit.mdsd.m2m2c.queries.Queries" point="org.eclipse.viatra.query.runtime.queryspecification"> | ||
<group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.mdsd.m2m2c.queries.Queries" id="hu.bme.mit.mdsd.m2m2c.queries.Queries"> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.entityAttribute"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.superEntity"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.allSuperEntity"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.relationWithLeftEnding"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.relationWithRightEnding"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.multiplicity"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.relationTarget"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.relationLeftWithMany"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.relationRightWithMany"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.relation"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.tracedAttributeOfTable"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.traceOfRootElement"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.traceOfElement"/> | ||
</group> | ||
</extension> | ||
<extension id="hu.bme.mit.mdsd.m2m2c.queries.TraceQueries" point="org.eclipse.viatra.query.runtime.queryspecification"> | ||
<group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.mdsd.m2m2c.queries.TraceQueries" id="hu.bme.mit.mdsd.m2m2c.queries.TraceQueries"> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.entity_C"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.entity_UD"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.attribute_C"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.attribute_U"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.attribute_D"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.relation_C"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.relation_D"/> | ||
<query-specification fqn="hu.bme.mit.mdsd.m2m2c.queries.relation_U"/> | ||
</group> | ||
</extension> | ||
</plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
hu.bme.mit.mdsd.m2m2c/src/hu/bme/mit/mdsd/m2m2c/rules/AttributeRule_C.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package hu.bme.mit.mdsd.m2m2c.rules | ||
|
||
import hu.bme.mit.mdsd.m2m2c.queries.Attribute_CMatcher | ||
import hu.bme.mit.mdsd.rdb.Column | ||
import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine | ||
import org.eclipse.viatra.transformation.evm.specific.crud.CRUDActivationStateEnum | ||
import org.eclipse.viatra.transformation.runtime.emf.modelmanipulation.IModelManipulations | ||
import trace.TraceRoot | ||
|
||
class AttributeRule_C extends AbstractRule{ | ||
|
||
new(ViatraQueryEngine engine, IModelManipulations manipulation, TraceRoot traceRoot) { | ||
super(engine, manipulation, traceRoot) | ||
rule = createRule.name("AttributeRule") | ||
// left hand side - queries a single entity | ||
.precondition(Attribute_CMatcher.querySpecification) | ||
.action(CRUDActivationStateEnum.CREATED) [ | ||
println('''AttributeRule CREATED («attribute.name»)''') | ||
|
||
var column = attribute.createColumnFromAttribute(table) as Column | ||
column.set(rdbPackage.namedElement_Name, attribute.name) | ||
|
||
createTrace(traceRoot, attribute, column) | ||
].build | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
hu.bme.mit.mdsd.m2m2c/src/hu/bme/mit/mdsd/m2m2c/rules/AttributeRule_D.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package hu.bme.mit.mdsd.m2m2c.rules | ||
|
||
import hu.bme.mit.mdsd.m2m2c.queries.Attribute_DMatcher | ||
import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine | ||
import org.eclipse.viatra.transformation.evm.specific.crud.CRUDActivationStateEnum | ||
import org.eclipse.viatra.transformation.runtime.emf.modelmanipulation.IModelManipulations | ||
import trace.TraceRoot | ||
|
||
class AttributeRule_D extends AbstractRule{ | ||
|
||
new(ViatraQueryEngine engine, IModelManipulations manipulation, TraceRoot traceRoot) { | ||
super(engine, manipulation, traceRoot) | ||
|
||
rule = createRule.name("AttributeRule") | ||
// left hand side - queries a single entity | ||
.precondition(Attribute_DMatcher.querySpecification) | ||
.action(CRUDActivationStateEnum.CREATED) [ | ||
println('''AttributeRule CREATED [empty RHS] («attribute.name»)''') | ||
|
||
].action(CRUDActivationStateEnum.DELETED) [ | ||
println('''AttributeRule DELETED («attribute.name»)''') | ||
|
||
deleteTrace(trace) | ||
].build | ||
|
||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
hu.bme.mit.mdsd.m2m2c/src/hu/bme/mit/mdsd/m2m2c/rules/AttributeRule_U.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package hu.bme.mit.mdsd.m2m2c.rules | ||
|
||
import hu.bme.mit.mdsd.m2m2c.queries.Attribute_UMatcher | ||
import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine | ||
import org.eclipse.viatra.transformation.evm.specific.crud.CRUDActivationStateEnum | ||
import org.eclipse.viatra.transformation.runtime.emf.modelmanipulation.IModelManipulations | ||
import trace.TraceRoot | ||
|
||
class AttributeRule_U extends AbstractRule{ | ||
|
||
new(ViatraQueryEngine engine, IModelManipulations manipulation, TraceRoot traceRoot) { | ||
super(engine, manipulation, traceRoot) | ||
|
||
rule = createRule.name("AttributeRule") | ||
// left hand side - queries a single entity | ||
.precondition(Attribute_UMatcher.querySpecification) | ||
.action(CRUDActivationStateEnum.CREATED) [ | ||
println('''AttributeRule CREATED [empty RHS] («attribute.name»)''') | ||
|
||
].action(CRUDActivationStateEnum.UPDATED) [ | ||
println('''AttributeRule UPDATED («attribute.name»)''') | ||
|
||
if(!attribute.name.equals(column.name)){ | ||
column.set(rdbPackage.namedElement_Name, attribute.name) | ||
} | ||
if(!attribute.type.columnType.equals(column.type)){ | ||
column.set(rdbPackage.column_Type, attribute.type.columnType) | ||
} | ||
].build | ||
|
||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
hu.bme.mit.mdsd.m2m2c/src/hu/bme/mit/mdsd/m2m2c/rules/EntityRule_UD.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package hu.bme.mit.mdsd.m2m2c.rules | ||
|
||
import hu.bme.mit.mdsd.m2m2c.queries.Entity_UDMatcher | ||
import hu.bme.mit.mdsd.rdb.Key | ||
import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine | ||
import org.eclipse.viatra.transformation.evm.specific.crud.CRUDActivationStateEnum | ||
import org.eclipse.viatra.transformation.runtime.emf.modelmanipulation.IModelManipulations | ||
import trace.TraceRoot | ||
|
||
class EntityRule_UD extends AbstractRule{ | ||
|
||
new(ViatraQueryEngine engine, IModelManipulations manipulation, TraceRoot traceRoot) { | ||
super(engine, manipulation, traceRoot) | ||
|
||
rule = createRule.name("EntityRule") | ||
// left hand side - queries a single entity | ||
.precondition(Entity_UDMatcher.querySpecification) | ||
.action(CRUDActivationStateEnum.CREATED) [ | ||
println('''EntityRule CREATED [empty RHS] («entity.name»)''') | ||
|
||
].action(CRUDActivationStateEnum.UPDATED) [ | ||
println('''EntityRule UPDATED («entity.name»)''') | ||
|
||
if(!entity.name.equals(table.name)){ | ||
table.set(rdbPackage.namedElement_Name, entity.name) | ||
} | ||
|
||
val key = table.columns.filter(Key).head | ||
if(!key.name.equals(entity.name + "_ID")){ | ||
key.set(rdbPackage.namedElement_Name, entity.name + "_ID") | ||
} | ||
|
||
].action(CRUDActivationStateEnum.DELETED)[ | ||
println('''EntityRule DELETED («entity.name»)''') | ||
|
||
deleteTrace(trace) | ||
].build | ||
} | ||
} |
Oops, something went wrong.