<?xml version="1.0" standalone="no"?>
<!DOCTYPE rulefile [
   <!ELEMENT rulefile (rule)*>
   <!ELEMENT rule (condition*, action*)>
   <!ELEMENT condition (conditionname, (function | constant | variable | logicalvariable)*)>
   <!ELEMENT action (actionname, (function | variable | constant | logicalvariable), constant*)>
   <!ELEMENT function (functionname, (constant | variable | logicalvariable)*)>
   <!ELEMENT constant (#PCDATA)>
   <!ELEMENT variable ((source | set), branch)>
   <!ELEMENT source (#PCDATA)>
   <!ELEMENT set (#PCDATA)>
   <!ELEMENT branch (#PCDATA)>
   <!ELEMENT conditionname (#PCDATA)>
   <!ELEMENT functionname (#PCDATA)>
   <!ELEMENT actionname (#PCDATA)>
   <!ELEMENT logicalvariable (#PCDATA)>
   <!ATTLIST conditionname sign (positive | negative) #REQUIRED>
   <!ATTLIST branch extract (textentry | subtree | nestedlist) #REQUIRED>
   <!ATTLIST logicalvariable type (singleton | set) #REQUIRED>
   <!ATTLIST rule code CDATA #REQUIRED
                  status (foundational | optional) #REQUIRED>
]>
<!-- Rules for the weather report case study. Conflicts settled by simple voting procedure, majority voting (caserules22.xml) -->
<!-- Version of: 16/7/2003 -->
<!-- change from 21 is that majority is used in rules 3, 19, 21, and 29 instead of threshold. -->
<rulefile>
	<rule code="1" status="foundational">
		<condition>
			<conditionname sign="positive"> acceptedsource </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/source</branch>
			</variable>
		</condition>
		<condition>
			<conditionname sign="positive"> samedate </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/date</branch>
			</variable>
		</condition>
		<condition>
			<conditionname sign="positive"> samecity </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/city</branch>
			</variable>
		</condition>
		<action>
			<actionname>Initialize</actionname>
			<constant>weatherreport(source,date,city,today,temp(max,min))</constant>
		</action>
		<action>
			<actionname>AddText</actionname>
			<function>
				<functionname>Conjunction</functionname>
				<variable>
					<set>1</set>
					<branch extract="textentry">weatherreport/source</branch>
				</variable>
			</function>
			<constant>weatherreport/source</constant>
		</action>
		<action>
			<actionname>AddText</actionname>
			<variable>
				<source>1</source>
				<branch extract="textentry">weatherreport/date</branch>
			</variable>
			<constant>weatherreport/date</constant>
		</action>
		<action>
			<actionname>AddText</actionname>
			<variable>
				<source>1</source>
				<branch extract="textentry">weatherreport/city</branch>
			</variable>
			<constant>weatherreport/city</constant>
		</action>
	</rule>
	<rule code="2" status="optional">
		<condition>
			<conditionname sign="positive"> equivalentterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/today</branch>
			</variable>
		</condition>
		<condition>
			<conditionname sign="positive"> preferredterm </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/today</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddText</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant>weatherreport/today</constant>
		</action>
	</rule>
	<rule code="3" status="optional">
		<condition>
			<conditionname sign="positive"> notequivalentterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/today</branch>
			</variable>
		</condition>
		<condition>
			<conditionname sign="positive"> preferredterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/today</branch>
			</variable>
			<logicalvariable type="set"> X </logicalvariable>
		</condition>
		<condition>
			<conditionname sign="positive"> majority </conditionname>
			<logicalvariable type="set"> X </logicalvariable>
			<logicalvariable type="singleton"> Y </logicalvariable>
		</condition>
		<action>
			<actionname>AddText</actionname>
			<logicalvariable type="singleton"> Y </logicalvariable>
			<constant>weatherreport/today</constant>
		</action>
	</rule>
	<rule code="4" status="optional">
		<condition>
			<conditionname sign="positive"> similartemps </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/temp/max</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddText</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant>weatherreport/temp/max</constant>
		</action>
	</rule>
	<rule code="5" status="optional">
		<condition>
			<conditionname sign="positive"> notsimilartemps </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/temp/max</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddText</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant>weatherreport/temp/max</constant>
		</action>
	</rule>
	<rule code="6" status="optional">
		<condition>
			<conditionname sign="positive"> similartemps </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/temp/min</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddText</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant>weatherreport/temp/min</constant>
		</action>
	</rule>
	<rule code="7" status="optional">
		<condition>
			<conditionname sign="positive"> notsimilartemps </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/temp/min</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddText</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant>weatherreport/temp/min</constant>
		</action>
	</rule>
	<rule code="8" status="optional">
		<condition>
			<conditionname sign="positive"> similarwindspeeds </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/windspeed</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> windspeed</constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="9" status="optional">
		<condition>
			<conditionname sign="positive"> notsimilarwindspeeds </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/windspeed</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> windspeed</constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="10" status="optional">
		<condition>
			<conditionname sign="positive"> similarhumidities </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/relativehumidity</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> relativehumidity</constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="11" status="optional">
		<condition>
			<conditionname sign="positive"> notsimilarhumidities </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/relativehumidity</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> relativehumidity</constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="12" status="optional">
		<condition>
			<conditionname sign="positive"> converttwelvehr </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/daylighthours/sunrise</branch>
			</variable>
			<logicalvariable type="set"> X </logicalvariable>
		</condition>
		<condition>
			<conditionname sign="positive"> similardaylighthours </conditionname>
			<logicalvariable type="set"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddNode</actionname>
			<constant>daylighthours</constant>
			<constant>weatherreport</constant>
		</action>
		<action>
			<actionname>AddAtomicTree</actionname>
			<function>
				<functionname>Interval</functionname>
				<logicalvariable type="set"> X </logicalvariable>
			</function>
			<constant> sunrise </constant>
			<constant> weatherreport/daylighthours </constant>
		</action>
	</rule>
	<rule code="13" status="optional">
		<condition>
			<conditionname sign="positive"> converttwelvehr </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/daylighthours/sunrise</branch>
			</variable>
			<logicalvariable type="set"> X </logicalvariable>
		</condition>
		<condition>
			<conditionname sign="positive"> notsimilardaylighthours </conditionname>
			<logicalvariable type="set"> X </logicalvariable>
			<logicalvariable type="singleton"> Y </logicalvariable>
		</condition>
		<action>
			<actionname>AddNode</actionname>
			<constant>daylighthours</constant>
			<constant>weatherreport</constant>
		</action>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> Y </logicalvariable>
			<constant> sunrise </constant>
			<constant> weatherreport/daylighthours </constant>
		</action>
	</rule>
	<rule code="14" status="optional">
		<condition>
			<conditionname sign="positive"> converttwelvehr </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/daylighthours/sunset</branch>
			</variable>
			<logicalvariable type="set"> X </logicalvariable>
		</condition>
		<condition>
			<conditionname sign="positive"> similardaylighthours </conditionname>
			<logicalvariable type="set"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<function>
				<functionname>Interval</functionname>
				<logicalvariable type="set"> X </logicalvariable>
			</function>
			<constant> sunset </constant>
			<constant> weatherreport/daylighthours </constant>
		</action>
	</rule>
	<rule code="15" status="optional">
		<condition>
			<conditionname sign="positive"> converttwelvehr </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/daylighthours/sunset</branch>
			</variable>
			<logicalvariable type="set"> X </logicalvariable>
		</condition>
		<condition>
			<conditionname sign="positive"> notsimilardaylighthours </conditionname>
			<logicalvariable type="set"> X </logicalvariable>
			<logicalvariable type="singleton"> Y </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> Y </logicalvariable>
			<constant> sunset </constant>
			<constant> weatherreport/daylighthours </constant>
		</action>
	</rule>
	<rule code="16" status="optional">
		<condition>
			<conditionname sign="positive"> similarabsolutevalues </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/pressure/absolutevalue</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddNode</actionname>
			<constant>pressure</constant>
			<constant>weatherreport</constant>
		</action>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> absolutevalue </constant>
			<constant> weatherreport/pressure </constant>
		</action>
	</rule>
	<rule code="17" status="optional">
		<condition>
			<conditionname sign="positive"> notsimilarabsolutevalues </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/pressure/absolutevalue</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddNode</actionname>
			<constant>pressure</constant>
			<constant>weatherreport</constant>
		</action>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> absolutevalue </constant>
			<constant> weatherreport/pressure </constant>
		</action>
	</rule>
	<rule code="18" status="optional">
		<condition>
			<conditionname sign="positive"> equivalentterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/pressure/directionofchange</branch>
			</variable>
		</condition>
		<condition>
			<conditionname sign="positive"> preferredterm </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/pressure/directionofchange</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> directionofchange </constant>
			<constant> weatherreport/pressure </constant>
		</action>
	</rule>
	<rule code="19" status="optional">
		<condition>
			<conditionname sign="positive"> notequivalentterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/pressure/directionofchange</branch>
			</variable>
		</condition>
		<condition>
			<conditionname sign="positive"> preferredterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/pressure/directionofchange</branch>
			</variable>
			<logicalvariable type="set"> X </logicalvariable>
		</condition>
		<condition>
			<conditionname sign="positive"> majority </conditionname>
			<logicalvariable type="set"> X </logicalvariable>
			<logicalvariable type="singleton"> Y </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> Y </logicalvariable>
			<constant> directionofchange </constant>
			<constant> weatherreport/pressure </constant>
		</action>
	</rule>
	<rule code="20" status="optional">
		<condition>
			<conditionname sign="positive"> equivalentterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/visibility</branch>
			</variable>
		</condition>
		<condition>
			<conditionname sign="positive"> preferredterm </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/visibility</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> visibility </constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="21" status="optional">
		<condition>
			<conditionname sign="positive"> notequivalentterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/visibility</branch>
			</variable>
		</condition>
		<condition>
			<conditionname sign="positive"> preferredterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/visibility</branch>
			</variable>
			<logicalvariable type="set"> X </logicalvariable>
		</condition>
		<condition>
			<conditionname sign="positive"> majority </conditionname>
			<logicalvariable type="set"> X </logicalvariable>
			<logicalvariable type="singleton"> Y </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> Y </logicalvariable>
			<constant> visibility </constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="22" status="optional">
		<condition>
			<conditionname sign="positive"> similardistances </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/visibilitydistance</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> visibilitydistance</constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="23" status="optional">
		<condition>
			<conditionname sign="positive"> notsimilardistances </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/visibilitydistance</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> visibilitydistance</constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="24" status="optional">
		<condition>
			<conditionname sign="positive"> similarindices </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/airpollutionindex</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> airpollutionindex</constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="25" status="optional">
		<condition>
			<conditionname sign="positive"> notsimilarindices </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/airpollutionindex</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> airpollutionindex </constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="26" status="optional">
		<condition>
			<conditionname sign="positive"> similarindices </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/sunindex</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> sunindex </constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="27" status="optional">
		<condition>
			<conditionname sign="positive"> notsimilarindices </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/sunindex</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> sunindex </constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="28" status="optional">
		<condition>
			<conditionname sign="positive"> equivalentterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/sunindexrating</branch>
			</variable>
		</condition>
		<condition>
			<conditionname sign="positive"> preferredterm </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/sunindexrating</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> sunindexrating </constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="29" status="optional">
		<condition>
			<conditionname sign="positive"> notequivalentterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/sunindexrating</branch>
			</variable>
		</condition>
		<condition>
			<conditionname sign="positive"> preferredterms </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/sunindexrating</branch>
			</variable>
			<logicalvariable type="set"> X </logicalvariable>
		</condition>
		<condition>
			<conditionname sign="positive"> majority </conditionname>
			<logicalvariable type="set"> X </logicalvariable>
			<logicalvariable type="singleton"> Y </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> Y </logicalvariable>
			<constant> sunindexrating </constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="30" status="optional">
		<condition>
			<conditionname sign="positive"> similartemps </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/dewpoint</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> dewpoint</constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
	<rule code="31" status="optional">
		<condition>
			<conditionname sign="positive"> notsimilartemps </conditionname>
			<variable>
				<set>1</set>
				<branch extract="textentry">weatherreport/dewpoint</branch>
			</variable>
			<logicalvariable type="singleton"> X </logicalvariable>
		</condition>
		<action>
			<actionname>AddAtomicTree</actionname>
			<logicalvariable type="singleton"> X </logicalvariable>
			<constant> dewpoint</constant>
			<constant> weatherreport </constant>
		</action>
	</rule>
</rulefile>
