<?xml version="1.0"?>

<xs:schema 
targetNamespace="http://www.ruleml.org/0.87/xsd"
xmlns="http://www.ruleml.org/0.87/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>

	<xs:annotation>
		<xs:documentation xml:lang="en">
			Data RuleML elements module.
			This is the XML Schema data module for RuleML.
			File: data_module.xsd
			Version: 0.87
			Last Modification: 2004-08-06
			
			This module declares the following data RuleML elements/attributes:
			* @type
			* @index
			* arg
			* Ind
			* Var
			
			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>

	<!--
		*** @type ***
		
		Optionally specifies the term's type.
	-->
	<xs:attributeGroup name="type.attrib">
		<xs:attribute name="type" type="xs:string" use="optional"/>
	</xs:attributeGroup>

	<!--
		*** @index ***
		
		Specifies the position of a positional argument within an Atom.
	-->
	<xs:attributeGroup name="index.attrib">
		<xs:attribute name="index" type="xs:positiveInteger" use="required"/>
	</xs:attributeGroup>

	<!--
		*** arg ***
		content model: ( Ind | Var )

		This is a role for the positional arguments of an Atom.  It is usually left implicit.
		A positional argument may be either an Ind or a Var (or, in hornlog, a Cterm).
		Requires an "index" attribute.
	-->
	<xs:attributeGroup name="arg.attlist">
		<xs:attributeGroup ref="index.attrib"/>
	</xs:attributeGroup>
	<xs:group name="arg.content">
		<xs:choice>
			<xs:element ref="Ind"/>
			<xs:element ref="Var"/>
		</xs:choice>
	</xs:group>
	<xs:complexType name="arg.type">
		<xs:group ref="arg.content"/>
		<xs:attributeGroup ref="arg.attlist"/>
	</xs:complexType>
	<xs:element name="arg" type="arg.type"/>

	<!--
		*** Ind ***
		content model: (#PCDATA)

		An individual constant, as in predicate logic.
		
		The one kind of fixed argument, generalizing RDF literals and resources.  It can be
		viewed logically as a logical function whose arity is zero.

		Individuals may have an optional 'type' attribute for term typing.
	-->
	<xs:attributeGroup name="Ind.attlist">
		<xs:attributeGroup ref="type.attrib"/>
	</xs:attributeGroup>
	<xs:group name="Ind.content">
		<xs:sequence/>
	</xs:group>
	<xs:complexType name="Ind.type" mixed="true">
		<xs:group ref="Ind.content"/>
		<xs:attributeGroup ref="Ind.attlist"/>
	</xs:complexType>
	<xs:element name="Ind" type="Ind.type"/>

	<!--
		*** Var ***
		content model: (#PCDATA)

		A logical variable, as in logic programming.

		The one kind of variable argument.
 
		Variables may have an optional 'type' attribute for term typing.
	-->
	<xs:attributeGroup name="Var.attlist">
		<xs:attributeGroup ref="type.attrib"/>
	</xs:attributeGroup>
	<xs:group name="Var.content">
		<xs:sequence/>
	</xs:group>
	<xs:complexType name="Var.type" mixed="true">
		<xs:group ref="Var.content"/>
		<xs:attributeGroup ref="Var.attlist"/>
	</xs:complexType>
	<xs:element name="Var" type="Var.type"/>

</xs:schema>
