title: DROOLS local variable assignment with nested members
body: <p>I am having trouble assigning a local variable with nested members/objects in DROOLS 6.2 and Optaplanner with two Java classes.  I am trying to determine when two facts/instances nested members have the same values.  The test case below is simple, in reality I'm trying to compare multiple nested members in a rule.</p>
  
  <pre><code>public class A {
    private B x;
    //public B getX(), public void setX(B b) follow ...
  }
  
  public class B {
    private int y;
    //public int getY(), public void setY(int y) follow ...
  }
  
  rule "testnestedmembers"
  when  
      A(x.y : y, $x : x)
      A(x2.y == y, $x : x2) 
  then 
      scoreHolder.addHardConstraintMatch(kcontext,-1000);
  
      Message [id=1, level=ERROR,      path=org/somebody/project/planner/solver/planScoreRules.drl, line=16, column=0
     text=[ERR 102] Line 16:49 mismatched input ':' in rule "testnestedmembers"]
      Message [id=2, level=ERROR, path=org/somebody/project/planner/solver/planScoreRules.drl, line=0, column=0 text=Parser returned a null Package]
      ---
      Warning Messages:
      ---
      Info Messages:
  
      at    org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildKieBase(ScoreDirectorFactoryConfig.java:387)
  </code></pre>
  
  <p>I have reviewed some answers, such as:
  <a href="https://stackoverflow.com/questions/19347545/drools-rule-expression-access-nested-class-data-member">Drools Rule Expression : Access Nested class data member</a></p>
  
  <p>And Geoffrey De Smet's answer illustrates a conditional, but not a local assignment.
  I've tried different variations, but no luck.  Thank you for any advice.</p>
  
  <p><strong>Edit:</strong>  I should have said <strong>creating a binding</strong> instead of assigning a local variable.</p>