Tutorial Issue: createRule.precondition errors [message #1745171] |
Wed, 05 October 2016 23:46 |
|
Hello,
I'm walking through the VIATRA tutorial using Neon.1 installed via Eclipse Installer: Eclipse Modeling Tools, VIATRA Core (1.4-maintenance), VIATRA Tooling. I upgrade VIATRA to 1.4 after the install (1.3 was installed for whatever reason) and additionally installed Xtext SDK 2.10.0.
The following code below, from the "Specify which action to run when the rule fires." step in Section 4.1: Batch Transformations, has a couple error markers shown in the Xtend editor:
val hostRule = createRule.precondition(HostInstanceMatcher.querySpecification) [
val cpsHostInstance = it.hostInstance
val nodeIp = cpsHostInstance.nodeIp
println('''Mapping host with IP: «nodeIp»''')
/** Create & initialize DeploymentHost in output model **/
val depHost = cps2dep.deployment.createChild(deployment_Hosts, deploymentHost) => [
set(deploymentHost_Ip, nodeIp)
]
/** Create trace element in trace model **/
cps2dep.createChild(CPSToDeployment_Traces, CPS2DeploymentTrace) => [
addTo(CPS2DeploymentTrace_CpsElements, cpsHostInstance)
addTo(CPS2DeploymentTrace_DeploymentElements, depHost)
]
println('''Mapped with IP: «nodeIp»''')
]
The first is on the createRule.precondition line:
Invalid number of arguments. The method precondition(IQuerySpecification<Matcher>) is not applicable for the arguments (IQuerySpecification<HostInstanceMatcher>,(ViatraQueryEngine)=>String)
The next error is with cpsHostInstance.nodeIp:
The method or field nodeIp is undefined for the type HostInstanceMatcher .
The same type of errors occur also for the val applicationRule = createRule.precondition.
Additionally, the execute method shows two errors for the following lines:
/* Fire transformation rules**/
hostRule.fireAllCurrent
applicationRule.fireAllCurrent
hostRule.fireAllCurrent error:
Type mismatch: cannot convert from BatchTransformationRuleFactory.BatchTransformationRuleBuilder<HostInstanceMatch, HostInstanceMatcher> to BatchTransformationRule<IPatternMatch, ?>
applicationRule.fireAllCurrent error:
Type mismatch: cannot convert from BatchTransformationRuleFactory.BatchTransformationRuleBuilder<ApplicationInstanceMatch, ApplicationInstanceMatcher> to BatchTransformationRule<IPatternMatch, ?>
What needs to be done to solve these errors?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03223 seconds