<?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"
>

	<xs:annotation>
		<xs:documentation xml:lang="en">
			XML Schema for a Hornlog RuleML sublanguage, including negation as failure (NAF)
			File: nafhornlog.xsd
			Version: 0.89
			Last Modification: 2005-07-14

			Note: this sublanguage wasn't included in the official 0.89 release, but 
			is now added for convenience.  It will officially be part of the 0.9 release.
		</xs:documentation>
	</xs:annotation>

	<!-- nafdhornlog includes the 'naf' module -->
	<xs:include schemaLocation="modules/naf_module.xsd"/>
	
	<!-- note the addition of Naf (negation as failure) from the negation module -->
	<xs:redefine schemaLocation="hornlog.xsd">

		<!--
			add Naf so that body's content model is:
			(Atom | And | Or | Naf)
		-->
		<xs:group name="body.content">
			<xs:choice>
				<xs:group ref="body.content"/>
				<xs:element ref="Naf"/>
			</xs:choice>
		</xs:group>		
		<!--
			note that the above indirectly adds Naf to Implies so that its content model is:
			( oid?, ( head, body) | ( body, head) | ( (Atom | And | Or | Naf), Atom ) )
		-->			

		<!--
			add Naf so that content's content model (when under Query) is:
			( Atom | And | Or | Exists | Naf )
		-->
		<xs:group name="content-query.content">
			<xs:choice>
				<xs:group ref="content-query.content"/>
				<xs:element ref="Naf"/>
			</xs:choice>	
		</xs:group>
		<!--
			note that the above indirectly adds Naf to Query so its content model is:
			(content | Atom | And | Or | Exists | Naf)
		-->		

		<!--
			add Naf so that formula's content model (when under And/Or) is:
			(Atom | And | Or | Naf)
		-->
		<xs:group name="formula-and-or.content">
			<xs:choice>
				<xs:group ref="formula-and-or.content"/>
				<xs:element ref="Naf"/>
			</xs:choice>	
		</xs:group>		
		<!--
			Note that the above indirectly adds Naf to And and Or so their content models are:
			( (formula | Atom | And | Or | Naf)* )
		-->
		
	</xs:redefine>
	
</xs:schema>
