<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
targetNamespace="http://www.ruleml.org/0.9/xsd" 
xmlns="http://www.ruleml.org/0.9/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
>

<!-- note that elementFormDefault is qualified because of the local declaration of Con -->

	<xs:annotation>
		<xs:documentation xml:lang="en">
			XML Schema for a Higher-Order Logic RuleML sublanguage
			File: hohornlog.xsd
			Version: 0.9
			Last Modification: 2005-11-09
		</xs:documentation>
	</xs:annotation>
	
	<!-- hilog includes the 'holog' module -->
	<xs:include schemaLocation="modules/holog_module.xsd"/>

	<!--
		note the replacement of Atoms and Cterms by Hterms, the neutralization of
		Ind, Rel and Ctor into Con, and the addition of Neg
	-->
	<xs:redefine schemaLocation="_nafhornlog-to-hohornlog.xsd">

		
		<!-- add Implies to Integrity (required by examples in SWSL report) -->
		<xs:group name="Integrity.extend">
			<xs:choice>
				<xs:group ref="Integrity.extend"/>
				<xs:element ref="Implies"/>	
			</xs:choice>			
		</xs:group>


		<!-- already added... comment out for now

			add op to Atom-frame:
			( oid, op?, slot* )

		<xs:group name="Atom-frame.extend">
			<xs:sequence>
				<xs:group ref="Atom-frame.extend"/>	
				<xs:choice minOccurs="0">
					<xs:element ref="op"/>				
					<xs:group ref="op.content"/>
				</xs:choice>
			</xs:sequence>
		</xs:group>
		-->

		<!-- add Hterm to formula-assert -->
		<xs:group name="formula-assert.content">
			<xs:choice>
				<xs:group ref="formula-assert.content"/>
				<xs:element ref="Hterm"/>				
			</xs:choice>
		</xs:group>	
		<!--
			note that the above indirectly adds Hterm to Assert so that its content model is:
			( (formula | Hterm | Implies | Equivalent | Forall)* )
		-->				

		<!-- add Hterm to strong -->
		<!--
			And is also added to strong; this is only necessary for Integritys, but limiting
			it to Integrity would require a lot of context sensitivity... therefore these SWSL XSDs
			are a extra permissive in this respect
		-->
		<xs:group name="strong.content">
			<xs:choice>
				<xs:group ref="strong.content"/>
				<xs:element ref="Hterm"/>
				<xs:element name="And" type="And-inner.type"/>
			</xs:choice>
		</xs:group>
		<!--
			note that the above indirectly adds Hterm to Neg so that its content model is:
			( oid?, (strong | Hterm) )
		-->

		<!-- add Hterm to weak -->
		<xs:group name="weak.content">
			<xs:choice>
				<xs:group ref="weak.content"/>
				<xs:element ref="Hterm"/>
			</xs:choice>
		</xs:group>
		<!--
			note that the above indirectly adds Hterm to Naf so that its content model is:
			( oid?, (strong | Hterm) )
		-->

		<!-- add Hterm and Con to arg -->
		<xs:group name="arg.content">
			<xs:choice>
				<xs:group ref="arg.content"/>
				<xs:element ref="Con"/>
				<xs:element ref="Hterm"/>
			</xs:choice>
		</xs:group>
		<!--
			note that the above indirectly adds Con and Hterm to slot so that its content model is:
			( (Con|Skolem|Var|Reify|Hterm), (Con|Skolem|Var|Reify|Hterm) )
		-->

		<!--
			add Con and Hterm to oid so that its content model is:
			(Con | Skolem | Var | Hterm)
		-->		
		<xs:group name="oid.content">
			<xs:choice>
				<xs:group ref="oid.content"/>
				<xs:element ref="Con"/>				
				<xs:element ref="Hterm"/>
			</xs:choice>
		</xs:group>		

		<!-- add Hterm and Neg to body -->
		<xs:group name="body.content">
			<xs:choice>
				<xs:group ref="body.content"/>
				<xs:element ref="Hterm"/>
				<xs:element ref="Neg"/>				
			</xs:choice>
		</xs:group>	
		
		<!-- add Hterm and Neg to head -->
		<xs:group name="head.content">
			<xs:choice>
				<xs:group ref="head.content"/>
				<xs:element ref="Hterm"/>
				<xs:element ref="Neg"/>				
			</xs:choice>
		</xs:group>
		<!--
			note that the above indirectly adds Hterm and Neg to Implies so that its content model is:
			( oid?, ( head, body) | ( body, head) | ( (And | Or | Hterm | Neg), (Hterm | Neg) ) )	
		-->	
		
		<!-- add Hterm to torso -->
		<xs:group name="torso.content">
			<xs:choice>
				<xs:group ref="torso.content"/>
				<xs:element ref="Hterm"/>				
			</xs:choice>
		</xs:group>	
		<!--
			note that the above indirectly adds Hterm to Equivalent so that its content model is:
			( oid?, ( ( torso, torso) | ( Hterm, Hterm ) ) )	
		-->			

		<!-- add Hterm and Neg to formula-and-or -->
		<xs:group name="formula-and-or.content">
			<xs:choice>
				<xs:group ref="formula-and-or.content"/>
				<xs:element ref="Hterm"/>
				<xs:element ref="Neg"/>				
			</xs:choice>
		</xs:group>	
		<!--
			note that the above indirectly adds Hterm and Neg to And, Or, and Integrity so
			that their content model is:
			( oid?, (formula | Hterm | And | Or | Neg)* )
		-->

		<!-- add Hterm and Neg to formula-query -->		
		<xs:group name="formula-query.content">
			<xs:choice>
				<xs:group ref="formula-query.content"/>
				<xs:element ref="Hterm"/>
				<xs:element ref="Neg"/>
			</xs:choice>
		</xs:group>	
		<!--
			note that the above indirectly adds Hterm to Query so that its content model is:
			( (formula | Hterm | And | Or | Exists | Neg)* )
		-->
		
		<!-- add Hterm to formula-forall -->	
		<xs:group name="formula-forall.content">
			<xs:choice>
				<xs:group ref="formula-forall.content"/>
				<xs:element ref="Hterm"/>			
			</xs:choice>
		</xs:group>
		<!--
			note that the above indirectly adds Hterm to Forall so that its content model is:
			( oid?, (declare | Var)+, (formula | Hterm | Implies | Equivalent | Forall) )
		-->
		
		<!-- add Hterm to formula-exists -->
		<xs:group name="formula-exists.content">
			<xs:choice>
				<xs:group ref="formula-exists.content"/>
				<xs:element ref="Hterm"/>	
			</xs:choice>
		</xs:group>
		<!--
			note that the above indirectly adds Hterm to Exists so that its content model is:
			( oid?, (declare | Var)+, (formula | Hterm | And | Or | Exists) )
		-->							

	</xs:redefine>

</xs:schema>
