<?xml version="1.0"?>

<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 'content' -->

	<xs:annotation>
		<xs:documentation xml:lang="en">
			Performative RuleML elements module.
			This is the XML Schema performative elements module for RuleML.
			File: performative_module.xsd
			Version: 0.89
			Last Modification: 2005-05-26
			
			This module declares the following toplevel RuleML elements/attributes:
			* Assert
			* Query
			* Protect
			* content
			* warden
			
			The approach is modelled after that used in "Modularization of XHTML in XML Schema"
			WD [http://www.w3.org/TR/xhtml-m12n-schema/], which will soon be integrated with
			"Modularization of XHTML" (REC-xhtml-modularization-20010410)
			[http://www.w3.org/TR/xhtml-modularization/].
		</xs:documentation>
	</xs:annotation>
	
	<!--
		*** Assert ***
		content model:
		( (content | And) )

		A KQML-like performative acting as a wrapper which specifies that its content is asserted.  This
		allows the separation of declarative contentfrom such procedural performatives.

		Note that an Assert-And nesting corresponds to a Rulebase in RuleML 0.87.

		See http://www.ruleml.org/fol/ for full details.
	-->
	<xs:attributeGroup name="Assert.attlist"/>
	<xs:group name="Assert.content">
		<xs:choice>
			<xs:element name="content" type="content-assert.type"/>			
			<xs:group ref="content-assert.content"/>
		</xs:choice>
	</xs:group>
	<xs:complexType name="Assert.type">
		<xs:group ref="Assert.content"/>
		<xs:attributeGroup ref="Assert.attlist"/>
	</xs:complexType>
	<xs:element name="Assert" type="Assert.type"/>
	
	<!--
		*** Query ***
		content model:
		(content | Atom | And | Or | Exists)

		A KQML-like performative acting as a wrapper which specifies that its content is queried.  This
		allows the separation of declarative content from such procedural performatives.
		
		See http://www.ruleml.org/fol/ for full details.
	-->
	<xs:attributeGroup name="Query.attlist"/>
	<xs:group name="Query.content">
		<xs:choice>
			<xs:element name="content" type="content-query.type"/>
			<xs:group ref="content-query.content"/>
		</xs:choice>			
	</xs:group>
	<xs:complexType name="Query.type">
		<xs:group ref="Query.content"/>
		<xs:attributeGroup ref="Query.attlist"/>
	</xs:complexType>
	<xs:element name="Query" type="Query.type"/>

	<!--
		*** Protect ***
		content model:
		( (warden | Mutex), (content | And) )

		A KQML-like performative acting as a wrapper which specifies that its content is protected.  This
		allows the separation of declarative content from such procedural performatives.  Note that mutual
		exclusion is also included.
	-->
	<xs:attributeGroup name="Protect.attlist"/>
	<xs:group name="Protect.content">
		<xs:sequence>
			<xs:choice>
				<xs:element ref="warden"/>
				<xs:group ref="warden.content"/>
			</xs:choice>
			<xs:choice>
				<xs:element name="content" type="content-assert.type"/>
				<xs:group ref="content-assert.content"/>
			</xs:choice>
		</xs:sequence>			
	</xs:group>
	<xs:complexType name="Protect.type">
		<xs:group ref="Protect.content"/>
		<xs:attributeGroup ref="Protect.attlist"/>
	</xs:complexType>
	<xs:element name="Protect" type="Protect.type"/>
	
	<!--
		*** content ***
		Note that this element's content model is context-sensitive, so it is locally declared.
		See http://www.w3.org/2000/04/26-csrules.html.

		content model (below Assert and Protect): ( And )
		content model (below Query): ( Atom | And | Or | Exists )

		The content of a performative. This is a metarole which may be left implicit.
	-->
	<xs:attributeGroup name="content.attlist"/>
	<xs:group name="content-assert.content">
		<xs:choice>
			<xs:element name="And" type="And-assert.type"/>
		</xs:choice>
	</xs:group>
	<xs:group name="content-query.content">
		<xs:choice>
			<xs:element name="Atom" type="Atom.type"/>
			<xs:element name="And" type="And-query.type"/>
			<xs:element name="Or" type="Or-query.type"/>	
			<xs:element ref="Exists"/>				
		</xs:choice>
	</xs:group>
	<xs:complexType name="content-assert.type">
		<xs:group ref="content-assert.content"/>
		<xs:attributeGroup ref="content.attlist"/>
	</xs:complexType>
	<xs:complexType name="content-query.type">
		<xs:group ref="content-query.content"/>
		<xs:attributeGroup ref="content.attlist"/>
	</xs:complexType>
	<xs:element name="content" type="content-assert.type"/>

	<!--
		*** warden ***
		content model: ( Mutex )

		The warden of a Mutex. This is a metarole which may be left implicit.
	-->
	<xs:attributeGroup name="warden.attlist"/>
	<xs:group name="warden.content">
		<xs:sequence>
			<xs:element ref="Mutex"/>
		</xs:sequence>
	</xs:group>
	<xs:complexType name="warden.type">
		<xs:group ref="warden.content"/>
		<xs:attributeGroup ref="warden.attlist"/>
	</xs:complexType>
	<xs:element name="warden" type="warden.type"/>

</xs:schema>

