<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 
targetNamespace="http://www.ruleml.org/0.88/xsd" 
xmlns="http://www.ruleml.org/0.88/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>

	<xs:annotation>
		<xs:documentation xml:lang="en">
			XML Schema for a Datalog RuleML sublanguage, including classical/strong negation
			File: negdatalog.xsd
			Version: 0.88
			Last Modification: 2005-01-20
		</xs:documentation>
	</xs:annotation>
	
	<!-- negdatalog includes the 'negation' module -->
	<xs:include schemaLocation="modules/negation_module.xsd"/>

	<!-- note the addition of Neg (classical Negation) from the Negation module -->
	<xs:redefine schemaLocation="datalog.xsd">

		<!--
			note that adding Neg to head and body automatically adds Neg to Implies so that its content model is:
		(
			oid?,	( head, body) | ( body, head) | ( (Atom | And | Or | Neg), (Atom | Neg) )
		)
		-->

		<!--
			add Neg so that head's content model is:
			(Atom | Neg)
		-->
		<xs:group name="head.content">
			<xs:choice>
				<xs:group ref="head.content"/>
				<xs:element ref="Neg"/>
			</xs:choice>
		</xs:group>
		
		<!--
			add Neg so that body's content model is:
			(Atom | And | Or | Neg)
		-->
		<xs:group name="body.content">
			<xs:choice>
				<xs:group ref="body.content"/>
				<xs:element ref="Neg"/>
			</xs:choice>
		</xs:group>		

		<!--
			add Neg so that content's content model (when under Query) is:
			( Atom | And | Neg )

			Note that this indirectly adds Neg to Query so its content model is:
			(content | Atom | And | Neg)
		-->
		<xs:group name="content-query.content">
			<xs:choice>
				<xs:group ref="content-query.content"/>
				<xs:element ref="Neg"/>
			</xs:choice>	
		</xs:group>

		<!--
			add Neg so that formula's content model (when under And/Or) is:
			(Atom | And | Or | Neg)

			Note that this indirectly adds Neg to And and Or so their content models are:
			( (formula | Atom | And | Or | Neg)* )
		-->
		<xs:group name="formula-and-or.content">
			<xs:choice>
				<xs:group ref="formula-and-or.content"/>
				<xs:element ref="Neg"/>
			</xs:choice>	
		</xs:group>

	</xs:redefine>
	
</xs:schema>
