@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix daml: <http://www.daml.org/2000/10/daml-ont#>.
@prefix nph:  <http://www.w3.org/2001/04/18/noun-phrase-names#>.
@prefix set:  <http://www.w3.org/2001/04/18/set#>.
@prefix tmpl: <http://www.w3.org/2001/04/18/template#>.
@prefix rule: <http://www.w3.org/2001/04/18/rule#>.
@prefix :     <#>.

#
:r1 a rule:Rule;
    rule:premise :tp1;
    rule:conclusion :tp2.

:tp1 a tmpl:Template;
     tmpl:statements { :a :b :x };
     tmpl:variables [ set:enumeration ( :x ) ].

:tp2 a tmpl:Template;
     tmpl:statements { :b :a :x };
     tmpl:variables [ set:enumeration ( :x ) ].

# same rule:

:vars set:enumeration ( :x :y ).
:r2 rule:premise [
      tmpl:statements { :aa :bb :x. :ab :bb :y };
      tmpl:variables :vars 
    ];
    rule:conclusion [
      tmpl:statements { :bb :aa :x };
      tmpl:variables :vars 
    ].

