Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA » Tutorial Issue and Viatra2 errors: createRule.precondition errors
Tutorial Issue and Viatra2 errors: createRule.precondition errors [message #1793658] Mon, 13 August 2018 11:29 Go to next message
aljia bouzidi is currently offline aljia bouzidiFriend
Messages: 8
Registered: February 2017
Junior Member
Hello,

I'm walking through the VIATRA tutorial using Oxygen: Eclipse Modeling Tools, VIATRA 2 and I installed Xtext SDK 2.12.

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»''')


val hostRule = createRule.precondition(HostInstanceMatcher.querySpecification).action[
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)
]

The first is on the (HostInstanceMatcher)

The method or field HostInstanceMatcher is undefined CPS2DeploymentTransformationViatra.xtend /com.inquerylabs.course.cps.viatra.batch/src/com/inquerylabs/course/cps/viatra/batch line: 46 /com.inquerylabs.course.cps.viatra.batch/src/com/inquerylabs/course/cps/viatra/batch/CPS2DeploymentTransformationViatra.xtend Xtend Problem


The second is on the (it.hostInstance)
Description Resource Path Location Type
Type mismatch: cannot convert from IPatternMatch to ViatraQueryEngine CPS2DeploymentTransformationViatra.xtend /com.inquerylabs.course.cps.viatra.batch/src/com/inquerylabs/course/cps/viatra/batch line: 47 /com.inquerylabs.course.cps.viatra.batch/src/com/inquerylabs/course/cps/viatra/batch/CPS2DeploymentTransformationViatra.xtend Xtend Problem

The third is on the (nodeIp)
Description Resource Path Location Type
The method or field nodeIp is undefined for the type HostInstance CPS2DeploymentTransformationViatra.xtend /com.inquerylabs.course.cps.viatra.incr/src/com/inquerylabs/course/cps/viatra/incr line: 72 /com.inquerylabs.course.cps.viatra.incr/src/com/inquerylabs/course/cps/viatra/incr/CPS2DeploymentTransformationViatra.xtend Xtend Problem


What needs to be done to solve these errors?
Re: Tutorial Issue and Viatra2 errors: createRule.precondition errors [message #1793695 is a reply to message #1793658] Tue, 14 August 2018 08:14 Go to previous message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 189
Registered: September 2015
Senior Member
Hi,

only the first issue is relevant, the rest are there because the matcher class could not be found. I guess the problem is that your VIATRA Query project has the default code generation settings, which has changed since the tutorial was written.
Replace HostInstanceMatcher with HostInstance.Matcher and use quick fix or content assist to import it.

We will update the tutorial code snippets to match the new default code generation settings (see https://www.eclipse.org/viatra/documentation/releases.html#_code_generator_updates and https://www.eclipse.org/viatra/documentation/releases.html#_updated_generated_code_structure ).

You can check http://git.eclipse.org/c/viatra/org.eclipse.viatra.examples.git/tree/cps/transformations/org.eclipse.viatra.examples.cps.xform.m2m.batch.viatra/src/org/eclipse/viatra/examples/cps/xform/m2m/batch/viatra/rules/RuleProvider.xtend#n63 for an up to date and continuously built batch VIATRA transformation.
Previous Topic:tutorial: creating a ui plugin
Goto Forum:
  


Current Time: Sat Sep 22 11:10:58 GMT 2018

Powered by FUDForum. Page generated in 0.01861 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top