RuleGraph rg;
Site s = arg0.site;
if (s.getState() == null){
rg = new RuleGraph(new BondNode());
RuleGraph r1 = new RuleGraph(new Node(arg0.agent));
final Link key = new Link("1",s.getName());
if (template == null){
rg.addChild(key, r1);
d.q.add(pairOf(arg0.agent, r1));
} else {
rg.addChild(key, template.getChildrenMap().get(key));
rg.addChild(new Link("2",s.getName()), r1);
d.q.add(pairOf(arg0.agent, r1));
}
Pair<Agent, RuleGraph> r2 = createRuleGraph(d, rg, arg0.agent, s);
if (r2 != null && r2.fst != null)