<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
targetNamespace="http://www.ruleml.org/0.89/xsd" 
xmlns="http://www.ruleml.org/0.89/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
>

<!-- note that elementFormDefault is qualified because of the local declaration of And/Or -->

	<xs:annotation>
		<xs:documentation xml:lang="en">
			Behind-the-scenes XML Schema for the transition from hornlog to hohornlog
			File: _hornlog-to-hohornlog.xsd
			Version: 0.89
			Last Modification: 2005-05-27
		</xs:documentation>
	</xs:annotation>

	<!-- hohornlog redefines the 'neg' module, removing Atom -->
	<xs:redefine schemaLocation="modules/neg_module.xsd">

		<!-- remove Atom from strong by restriction -->
		<xs:group name="strong.content">
			<xs:choice/>
		</xs:group>
		<!--
			note that the above indirectly removes Atom from Neg so that its content model is:
			( oid?, (strong) )
		-->	

	</xs:redefine>
	
	<!-- note the removal of Atoms (thus also opr and Rel), Cterms (thus also opc and Ctor) and Ind -->
	<xs:redefine schemaLocation="hornlog.xsd">

		<!--
			remove opr from Atom-frame by restriction:
			( oid, slot* )
		 -->
		<xs:group name="Atom-frame.extend">
			<xs:sequence>
				<xs:element ref="oid"/>
			</xs:sequence>
		</xs:group>

		<!-- remove Ind, Data, Cterm and Plex from arg by restriction -->
		<xs:group name="arg.content">
			<xs:choice>
				<xs:element ref="Var"/>
				<xs:element ref="Skolem"/>
				<xs:element ref="Reify"/>			
			</xs:choice>
		</xs:group>
		<!--
			note that the above indirectly removes Ind, Data and Cterm from slot so that its content model is:
			( (Skolem | Var | Reify), (Skolem | Var | Reify) )
		-->
		
		<!--
			remove Ind, Cterm and Plex from oid by restriction:
			(Skolem | Var)
		-->		
		<xs:group name="oid.content">
			<xs:choice>
				<xs:element ref="Data"/>
				<xs:element ref="Var"/>
				<xs:element ref="Skolem"/>
				<xs:element ref="Reify"/>
			</xs:choice>
		</xs:group>			

		<!-- remove Atom from body by restriction -->
		<xs:group name="body.content">
			<xs:choice>
				<xs:element name="And" type="And-inner.type"/>
				<xs:element name="Or" type="Or-inner.type"/>			
			</xs:choice>
		</xs:group>
		
		<!-- remove Atom from head by restriction -->
		<xs:group name="head.content">
			<xs:choice/>
		</xs:group>	
		<!--
			note that the above indirectly removes Atom from Implies so that its content model is:
			( oid?, ( head, body) | ( body, head) | ( (And | Or), () ) )	
		-->

		<!--
			remove Atom from formula-oppo by restriction
		-->
		<xs:group name="formula-oppo.content">
			<xs:choice/>			
		</xs:group>

		<!-- remove Atom from torso by restriction -->
		<xs:group name="torso.content">
			<xs:choice/>		
		</xs:group>
		<!--
			note that the above indirectly removes Atom from Equivalent so that its content model is:
			( oid?, ( ( torso, torso) | ( (), () ) ) )	
		-->

		<!-- remove Atom from formula-top-and by restriction -->
		<xs:group name="formula-top-and.content">
			<xs:choice>
				<xs:element ref="Implies"/>			
				<xs:element ref="Equivalent"/>			
				<xs:element ref="Forall"/>			
			</xs:choice>
		</xs:group>	
		<!--
			note that the above indirectly removes Atom from top level And so that its content model is:
			( oid?, (formula | Implies | Equivalent | Forall)* )
		-->	
		
		<!-- remove Atom from formula-and-or by restriction -->		
		<xs:group name="formula-and-or.content">
			<xs:choice>
				<xs:element name="And" type="And-inner.type"/>
				<xs:element name="Or" type="Or-inner.type"/>
			</xs:choice>
		</xs:group>
		<!--
			note that the above indirectly removes Atom from And & Or so that their content model is:
			( oid?, (formula | And | Or)* )
		-->	
		
		<!-- remove Atom from content-query by restriction -->		
		<xs:group name="content-query.content">
			<xs:choice>
				<xs:element name="And" type="And-query.type"/>
				<xs:element name="Or" type="Or-query.type"/>	
				<xs:element ref="Exists"/>				
			</xs:choice>
		</xs:group>	
		<!--
			note that the above indirectly removes Atom from Query so that its content model is:
			(content | And | Or | Exists)
		-->

		<!-- remove Atom from formula-forall by restriction -->
		<xs:group name="formula-forall.content">
			<xs:choice>
				<xs:element ref="Implies"/>			
				<xs:element ref="Equivalent"/>			
				<xs:element ref="Forall"/>				
			</xs:choice>
		</xs:group>
		<!--
			note that the above indirectly removes Atom from Forall so that its content model is:
			( oid?, (declare | Var)+, (formula | Implies | Equivalent | Forall) )
		-->	

		<!-- remove Atom from formula-exists by restriction -->
		<xs:group name="formula-exists.content">
			<xs:choice>
				<xs:element name="And" type="And-inner.type"/>
				<xs:element name="Or" type="Or-inner.type"/>		
				<xs:element ref="Exists"/>	
			</xs:choice>
		</xs:group>
		<!--
			note that the above indirectly removes Atom from Exists so that its content model is:
			( oid?, (declare | Var)+, (formula | And | Or | Exists) )
		-->			
		
	</xs:redefine>

</xs:schema>
