<commit_before><?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.opencog.org/brain"
            xmlns:pet="http://www.opencog.org/brain"
            xmlns:common="http://www.opencog.org/metadata/common"
            xmlns:action="http://www.opencog.org/metadata/action"
            elementFormDefault="unqualified"
            attributeFormDefault="unqualified">

    <xsd:import namespace="http://www.opencog.org/metadata/common"
                schemaLocation="CommonMetadata.xsd"/>

    <xsd:import namespace="http://www.opencog.org/metadata/action"
                schemaLocation="PetActionMetadata.xsd"/>    

    <xsd:annotation>
        <xsd:documentation>
        &lt;sl-request&gt; messages are the XML representation of the JSON-esque
        messages sent by our pets and objects.  These messages can express the
        complexity of any SL requestContext in its entirety.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:element name="sl-request" type="pet:RequestType"/>

    <xsd:complexType name="RequestType">
        <xsd:sequence>
            <xsd:element name="rez" type="pet:RezType" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="derez" type="pet:DerezType" minOccurs="0" maxOccurs="1"/>
            <xsd:choice minOccurs="1" maxOccurs="unbounded">
                <xsd:element name="map-info" type="pet:MapInfoType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="agent-sensor-info" type="pet:AgentSensorInfoType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="object-signals" type="pet:ObjectSignalsType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="avatar-signals" type="pet:AvatarSignalsType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="pet-signals" type="pet:PetSignalsType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="instructions" type="pet:PetInstructionsType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="agent-signals" type="pet:AgentSignalsType" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>
        <!-- make sure to add a requestor-id as an optional attribute,
             I'm sure it will help lookups later in the call sequence -->
        <xsd:attribute name="request-id" type="xsd:string" use="required"/>
        <xsd:attribute name="entity-id" type="xsd:string" use="optional" default=""/>
        <xsd:attribute name="requestor-type" type="common:EntityDataType" use="optional" default="unknown"/>
        <xsd:attribute name="version" type="xsd:string" use="optional"/>
    </xsd:complexType>

    <xsd:element name="embodiment-msg" type="pet:EmbodimentMsgType"/>

    <xsd:complexType name="EmbodimentMsgType">
        <xsd:sequence>
            <xsd:choice minOccurs="0" maxOccurs="unbounded">
                <xsd:element name="map-info" type="pet:MapInfoType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="agent-sensor-info" type="pet:AgentSensorInfoType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="object-signal" type="pet:ObjectSignalType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="avatar-signal" type="pet:AvatarSignalType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="pet-signal" type="pet:PetSignalType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="instruction" type="pet:PetInstructionType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="agent-signal" type="pet:AgentSignalType" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="request-id" type="xsd:string" use="optional"/>
    </xsd:complexType>    

    <!-- FIXME: cleanup the ObjectRezType so it only adds a bit more data to the
         grand scheme of header + blip data -->
    <xsd:complexType name="RezType">
                <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="DerezType">
        <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>
    </xsd:complexType>

    <xsd:annotation>
        <xsd:documentation>
        Physical signals may be processed simultaneously or as a result of one
        another, as such they bear an uncanny resemblance to an action plan, but
        may occur with or without the prompting of an action plan from NM and
        will be returned individually rather than in batch.  At one point I had
        considered using a session id, but the Proxy can use a session id
        internally to send signals in the appropriate order to the Brain.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="PetSignalsType">
        <xsd:sequence>
            <xsd:element name="pet-signal" type="pet:PetSignalType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="pet-signal" type="pet:PetSignalType"/>

    <xsd:complexType name="PetSignalType">
        <xsd:complexContent>
            <xsd:extension base="pet:BaseSignalType">
                <xsd:sequence/>
                <xsd:attribute name="pet-id" type="xsd:string" use="required"/>                 
                <xsd:attribute name="action-plan-id" type="xsd:string" use="optional"/>
                <xsd:attribute name="sequence" type="xsd:positiveInteger" use="optional"/>
                <xsd:attribute name="status" type="pet:StatusType" use="optional" default="done"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>



    <!-- agent-signal -->
    <xsd:annotation>
        <xsd:documentation>
        signals from agents, pertaining to agent specific actions
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="AgentSignalsType">
        <xsd:sequence>
            <xsd:element name="agent-signal" type="pet:AgentSignalType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="agent-signal" type="pet:AgentSignalType"/>
    
    <xsd:complexType name="AgentSignalType">
        <xsd:complexContent>
            <xsd:extension base="pet:BaseSignalType">
                <xsd:sequence/>
                <xsd:attribute name="agent-id" type="xsd:string" use="required"/>
                <xsd:attribute name="agent-type" type="xsd:string" use="required"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <!-- agent-signal -->



    <xsd:annotation>
        <xsd:documentation>
        signals from avatars, pertaining to avatar specific actions
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="AvatarSignalsType">
        <xsd:sequence>
            <xsd:element name="avatar-signal" type="pet:AvatarSignalType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="avatar-signal" type="pet:AvatarSignalType"/>
    
    <xsd:complexType name="AvatarSignalType">
        <xsd:complexContent>
            <xsd:extension base="pet:BaseSignalType">
                <xsd:sequence/>
                <xsd:attribute name="avatar-id" type="xsd:string" use="required"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    
    <xsd:annotation>
        <xsd:documentation>
        signals from objects that were created with the proper scripts
        by our vendors
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="ObjectSignalsType">
        <xsd:sequence>
            <xsd:element name="object-signal" type="pet:ObjectSignalType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="object-signal" type="pet:ObjectSignalType"/>
    
    <xsd:complexType name="ObjectSignalType">
        <xsd:complexContent>
            <xsd:extension base="pet:BaseSignalType">
                <xsd:sequence/>
                <xsd:attribute name="object-id" type="xsd:string" use="required"/>
            </xsd:extension>
        </xsd:complexContent>        
    </xsd:complexType>

    <xsd:complexType name="BaseSignalType" abstract="true">
        <xsd:sequence>
            <xsd:element name="param" type="pet:ParamType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="xsd:string" use="optional"/>        
        <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>
    </xsd:complexType>

    <xsd:annotation>
        <xsd:documentation>
        Instruction to pets will be sent as raw text strings. At some point the 
        PetBrain will be able to correlate these instructions (and variants)
        to an action plan template, which remains to be defined.  Since we would
        like pets to respond to commands issued by people other than just their
        owners, we'll give owners dog whistles (transferrable) that allow them to 
        instruct their pet or designate someone else to instruct them.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="PetInstructionsType">
        <xsd:sequence>
            <xsd:element name="instruction" type="pet:PetInstructionType" minOccurs="1" maxOccurs="unbounded"/>            
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="instruction"/>

    <xsd:annotation>
      <xsd:documentation>
        The text of an instruction can be plain, parsed or any other kind of format.
        However it must contains a parameter called length to indicate the sized of the
        given text. e.g.
        suppose that tag instruction is of type PetInstructionTextType
        &lt;instruction length="22"&gt;go fetch the blue ball&lt;/instruction&gt;
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="PetInstructionTextType">
      <xsd:simpleContent>
        <xsd:extension base="xsd:string">
          <xsd:attribute name="length" type="xsd:int"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>    

    <xsd:complexType name="PetInstructionType">
        <xsd:sequence>
            <xsd:element name="sentence" type="pet:PetInstructionTextType" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="parsed-sentence" type="pet:PetInstructionTextType" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="pet-id" type="xsd:string" use="required"/>   
        <xsd:attribute name="avatar-id" type="xsd:string" use="required"/>       
        <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>
        <!-- describes what kind is that instruction: SPECIFIC_COMMAND, QUESTION, etc.-->
        <xsd:attribute name="content-type" type="xsd:string" use="required"/> 
        <!-- this instruction is destinated for what agent operation mode? PLAYING, LEARNING, ANY, etc.-->
        <xsd:attribute name="target-mode" type="xsd:string" use="required"/>
    </xsd:complexType>

    <xsd:element name="agent-sensor-info" type="pet:AgentSensorInfoType"/>

    <xsd:annotation>
        <xsd:documentation>
	This type of message is required to provide informations about the agents sensory.
	Sensors like vision and hearing can exchange it's data to OAC via this message type
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="AgentSensorInfoType">
        <xsd:sequence>            
            <xsd:annotation>
                <xsd:documentation>
		Several perceptions may be exchanged in just oe agent sensor info.
		A perception is the signal generated by a specific sensor
                </xsd:documentation>
            </xsd:annotation>
            <xsd:element name="perception" type="pet:SensorPerceptionType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:annotation>
        <xsd:documentation>
	A perception is a data generated by a specific sensor. The subject is a classifier
	of the sensor signal. The signal is the raw data of the sensor's perception
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="SensorPerceptionType">
        <xsd:attribute name="sensor" type="xsd:string" use="required"/>
        <xsd:attribute name="subject" type="xsd:string" use="optional" default=""/>
        <xsd:attribute name="signal" type="xsd:string" use="required"/>
    </xsd:complexType>

    <xsd:element name="map-info" type="pet:MapInfoType"/>

    <xsd:annotation>
        <xsd:documentation>
        Map data aggregated from SecondLife, the goal here will be to provide
        information on which blips are ours.  The map size will be difficult to
        determine as LSL sensors search spherically.  Even though certain 
        pieces of information will be easier to gather on Sheep owned islands
        the limits of LSL will make it difficult to provide a complete "live" map.
        The map data will represent all that is known about a gridParcel at a particular
        time.  Blip coordinates will be global to all simulators (regions).  The 
        gridParcel attribute may not prove useful here, but will remain until I'm certain
        it's not.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="MapInfoType">
        <xsd:sequence>
            <xsd:annotation>
                <xsd:documentation>
                The map data behaves much like a radar screen, a grid with a
                series of blips that represent nearby entities.
                </xsd:documentation>
            </xsd:annotation>
            <xsd:element name="blip" type="pet:BlipType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="global-position-x" type="xsd:int" use="required"/>
        <xsd:attribute name="global-position-y" type="xsd:int" use="required"/>        
        <xsd:attribute name="global-position-offset" type="xsd:int" use="required"/>
        <xsd:attribute name="gridParcel" type="xsd:string" use="optional"/>
    </xsd:complexType>
        
    <xsd:annotation>
        <xsd:documentation>
        Blips on the radar that indicate an entity, its position and the time
        that it was spotted at that location.
        </xsd:documentation>
      </xsd:annotation>

    <xsd:complexType name="BlipType">
        
        <xsd:sequence>
            <xsd:element name="entity" type="pet:EntityType" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="position" type="common:VectorDataType" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="rotation" type="common:RotationDataType" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="velocity" type="common:VectorDataType" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="dimension" type="common:VectorDataType" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="properties" type="pet:PropertiesType" minOccurs="0" maxOccurs="1"/>
         </xsd:sequence>
         
        <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>

               <!--
        <xsd:attribute name="detector" type="xsd:boolean" use="optional" default="false">
            <xsd:annotation>
                <xsd:documentation>
                if the detector attribute is true this means that this blip did
                some of the sensing
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="remove" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="visibility-status" type="xsd:string" use="optional" default="non-visible"/>
        <xsd:attribute name="length" type="xsd:double" use="optional" default="0.67"/>
        <xsd:attribute name="width" type="xsd:double" use="optional" default="0.33"/>
        <xsd:attribute name="height" type="xsd:double" use="optional" default="0.5"/>
        <xsd:attribute name="edible" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="drinkable" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="petHome" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="foodBowl" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="waterBowl" type="xsd:boolean" use="optional" default="false"/>
        -->
    </xsd:complexType>

    <xsd:complexType name="PropertiesType">
        <xsd:sequence>
          <xsd:element name="property" type="pet:PropertyType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="PropertyType">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="value" type="xsd:string" use="required"/>
    </xsd:complexType>      


    <xsd:annotation>
        <xsd:documentation>
        The entity id and type will allow for reasonably simple differentiation of 
        pet, pet toys, avatars, and static structures. Owner-id may not be necessary,
        but it could potentially be useful.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="EntityType">
        <xsd:complexContent>
            <xsd:extension base="common:BaseEntityType">
                <xsd:sequence>
                    <xsd:element name="metadata" type="pet:ParamType"
                                 minOccurs="0" maxOccurs="unbounded"/>
                </xsd:sequence>
                <xsd:attribute name="name" type="xsd:string" use="optional"/>
                <xsd:attribute name="owner-id" type="xsd:string" use="optional"/>
                <xsd:attribute name="owner-name" type="xsd:string" use="optional"/>
                <xsd:attribute name="session-id" type="xsd:string" use="optional"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:annotation>
        <xsd:documentation><![CDATA[
        All pets will be able to perform some sort of action, whether this action
        is navigation or a simple head-tilt or ear waggle.  To enable complicated
        movements, I've allowed the specification of the action sequence to be
        somewhat open-ended.  In most cases, I imagine the action sequence will 
        look like so:
            <action-plan id="#unique-id#" pet-id"1138">
                <action name="walk" sequence="1">                  
                    <param name="destination" type="vector">
                        <vector x="209.1" y="10.0" z="21.4"/>
                    </param>
                    <param name="speed" type="int" value="30"/>
                </action>
                <action name="fly" sequence="2">
                    // fly approximately 50 meters
                    <param name="destination" type="vector">
                        <vector x="259.1" y="20.0" z="31.4"/>
                    </param
                    // instead of flying in a diagonal line, we
                    // make the flight an arc through space.
                    <param name="arc" type="rotation">
                        <rotation yaw="5" pitch="10" roll="0"/>
                    </param>
                    // speed is in meters/second
                    <param name="speed" type="int" value="60"/>
                </action>
            </action-plan>
        ]]>
        </xsd:documentation>
    </xsd:annotation>
    <xsd:element name="action-plan" type="pet:ActionPlanType"/>
    
    <xsd:complexType name="ActionPlanType">
        <xsd:sequence>
            <xsd:choice minOccurs="1" maxOccurs="unbounded">
                <xsd:element name="parallel" type="pet:ParallelActionType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="action" type="pet:SequencedActionType" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>           
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:string" use="required"/>
        <xsd:attribute name="entity-id" type="xsd:string" use="required"/>
        <xsd:attribute name="entity-type" type="common:EntityDataType" use="optional" default="pet"/>
    </xsd:complexType>

    <xsd:complexType name="ParamType">
        <xsd:complexContent>
            <xsd:extension base="common:BaseParameterType">
                <xsd:sequence>
                    <xsd:choice minOccurs="0" maxOccurs="1">
                        <xsd:element name="vector" type="common:VectorDataType" minOccurs="1" maxOccurs="1"/>
                        <xsd:element name="rotation" type="common:RotationDataType" minOccurs="1" maxOccurs="1"/>
                        <xsd:element name="entity" type="pet:EntityType" minOccurs="1" maxOccurs="1"/>
                        <xsd:element name="list" type="common:ListDataType" minOccurs="1" maxOccurs="1"/>
                        <xsd:element name="value" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                    </xsd:choice>
                </xsd:sequence>
                <xsd:attribute name="value" type="xsd:string" use="optional"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ActionType">
        <xsd:complexContent>
            <xsd:extension base="common:BaseActionType">
                <xsd:sequence>
                    <xsd:element name="param" type="pet:ParamType" minOccurs="0" maxOccurs="unbounded"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="SequencedActionType">
        <xsd:complexContent>
            <xsd:extension base="pet:ActionType">
                <xsd:sequence/>
                <xsd:attribute name="sequence" type="xsd:positiveInteger" use="required"/>
                <xsd:attribute name="reportable" type="xsd:boolean" use="optional" default="true"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ParallelActionType">
        <xsd:sequence>
            <xsd:element name="action" type="pet:SequencedActionType" minOccurs="2" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>    
    
    <xsd:simpleType name="StatusType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="done"/>
            <xsd:enumeration value="error"/>
        </xsd:restriction>
    </xsd:simpleType>
        
    <xsd:annotation>
        <xsd:documentation>
            An Entity Metadata element represents a set of attributes that
            describe the entity identified in the "id" field.  The idea
            is to allow attributes to be modified over time, but have a
            document such as this one which will allow others to view that
            metadata as they see fit. Clients of these elements include:
            web portals and the AI router.  These documents may be used to
            describe updates to metadata as well.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:element name="entity-metadata" type="pet:EntityMetadataType"/>

    <xsd:complexType name="EntityMetadataType">
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string"
                         minOccurs="0" maxOccurs="1"/>
            <xsd:element name="attribute" type="pet:SimpleAttribute"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:string" use="required"/>
        <xsd:attribute name="type" type="common:EntityDataType" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="SimpleAttribute">
        <xsd:simpleContent>
            <xsd:extension base="xsd:string">
                <xsd:attribute name="name" type="xsd:string" use="required"/>
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType>

</xsd:schema>
<commit_msg>remove sl-request from embodiment xml schema. it's not referred to anywhere else in the embodiment code<commit_after><?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.opencog.org/brain"
            xmlns:pet="http://www.opencog.org/brain"
            xmlns:common="http://www.opencog.org/metadata/common"
            xmlns:action="http://www.opencog.org/metadata/action"
            elementFormDefault="unqualified"
            attributeFormDefault="unqualified">

    <xsd:import namespace="http://www.opencog.org/metadata/common"
                schemaLocation="CommonMetadata.xsd"/>

    <xsd:import namespace="http://www.opencog.org/metadata/action"
                schemaLocation="PetActionMetadata.xsd"/>    

    <xsd:element name="embodiment-msg" type="pet:EmbodimentMsgType"/>

    <xsd:complexType name="EmbodimentMsgType">
        <xsd:sequence>
            <xsd:choice minOccurs="0" maxOccurs="unbounded">
                <xsd:element name="map-info" type="pet:MapInfoType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="agent-sensor-info" type="pet:AgentSensorInfoType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="object-signal" type="pet:ObjectSignalType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="avatar-signal" type="pet:AvatarSignalType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="pet-signal" type="pet:PetSignalType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="instruction" type="pet:PetInstructionType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="agent-signal" type="pet:AgentSignalType" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>
        </xsd:sequence>
        <xsd:attribute name="request-id" type="xsd:string" use="optional"/>
    </xsd:complexType>    

    <!-- FIXME: cleanup the ObjectRezType so it only adds a bit more data to the
         grand scheme of header + blip data -->
    <xsd:complexType name="RezType">
                <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="DerezType">
        <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>
    </xsd:complexType>

    <xsd:annotation>
        <xsd:documentation>
        Physical signals may be processed simultaneously or as a result of one
        another, as such they bear an uncanny resemblance to an action plan, but
        may occur with or without the prompting of an action plan from NM and
        will be returned individually rather than in batch.  At one point I had
        considered using a session id, but the Proxy can use a session id
        internally to send signals in the appropriate order to the Brain.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="PetSignalsType">
        <xsd:sequence>
            <xsd:element name="pet-signal" type="pet:PetSignalType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="pet-signal" type="pet:PetSignalType"/>

    <xsd:complexType name="PetSignalType">
        <xsd:complexContent>
            <xsd:extension base="pet:BaseSignalType">
                <xsd:sequence/>
                <xsd:attribute name="pet-id" type="xsd:string" use="required"/>                 
                <xsd:attribute name="action-plan-id" type="xsd:string" use="optional"/>
                <xsd:attribute name="sequence" type="xsd:positiveInteger" use="optional"/>
                <xsd:attribute name="status" type="pet:StatusType" use="optional" default="done"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>



    <!-- agent-signal -->
    <xsd:annotation>
        <xsd:documentation>
        signals from agents, pertaining to agent specific actions
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="AgentSignalsType">
        <xsd:sequence>
            <xsd:element name="agent-signal" type="pet:AgentSignalType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="agent-signal" type="pet:AgentSignalType"/>
    
    <xsd:complexType name="AgentSignalType">
        <xsd:complexContent>
            <xsd:extension base="pet:BaseSignalType">
                <xsd:sequence/>
                <xsd:attribute name="agent-id" type="xsd:string" use="required"/>
                <xsd:attribute name="agent-type" type="xsd:string" use="required"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <!-- agent-signal -->



    <xsd:annotation>
        <xsd:documentation>
        signals from avatars, pertaining to avatar specific actions
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="AvatarSignalsType">
        <xsd:sequence>
            <xsd:element name="avatar-signal" type="pet:AvatarSignalType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="avatar-signal" type="pet:AvatarSignalType"/>
    
    <xsd:complexType name="AvatarSignalType">
        <xsd:complexContent>
            <xsd:extension base="pet:BaseSignalType">
                <xsd:sequence/>
                <xsd:attribute name="avatar-id" type="xsd:string" use="required"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    
    <xsd:annotation>
        <xsd:documentation>
        signals from objects that were created with the proper scripts
        by our vendors
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="ObjectSignalsType">
        <xsd:sequence>
            <xsd:element name="object-signal" type="pet:ObjectSignalType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="object-signal" type="pet:ObjectSignalType"/>
    
    <xsd:complexType name="ObjectSignalType">
        <xsd:complexContent>
            <xsd:extension base="pet:BaseSignalType">
                <xsd:sequence/>
                <xsd:attribute name="object-id" type="xsd:string" use="required"/>
            </xsd:extension>
        </xsd:complexContent>        
    </xsd:complexType>

    <xsd:complexType name="BaseSignalType" abstract="true">
        <xsd:sequence>
            <xsd:element name="param" type="pet:ParamType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="name" type="xsd:string" use="optional"/>        
        <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>
    </xsd:complexType>

    <xsd:annotation>
        <xsd:documentation>
        Instruction to pets will be sent as raw text strings. At some point the 
        PetBrain will be able to correlate these instructions (and variants)
        to an action plan template, which remains to be defined.  Since we would
        like pets to respond to commands issued by people other than just their
        owners, we'll give owners dog whistles (transferrable) that allow them to 
        instruct their pet or designate someone else to instruct them.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="PetInstructionsType">
        <xsd:sequence>
            <xsd:element name="instruction" type="pet:PetInstructionType" minOccurs="1" maxOccurs="unbounded"/>            
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="instruction"/>

    <xsd:annotation>
      <xsd:documentation>
        The text of an instruction can be plain, parsed or any other kind of format.
        However it must contains a parameter called length to indicate the sized of the
        given text. e.g.
        suppose that tag instruction is of type PetInstructionTextType
        &lt;instruction length="22"&gt;go fetch the blue ball&lt;/instruction&gt;
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="PetInstructionTextType">
      <xsd:simpleContent>
        <xsd:extension base="xsd:string">
          <xsd:attribute name="length" type="xsd:int"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>    

    <xsd:complexType name="PetInstructionType">
        <xsd:sequence>
            <xsd:element name="sentence" type="pet:PetInstructionTextType" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="parsed-sentence" type="pet:PetInstructionTextType" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="pet-id" type="xsd:string" use="required"/>   
        <xsd:attribute name="avatar-id" type="xsd:string" use="required"/>       
        <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>
        <!-- describes what kind is that instruction: SPECIFIC_COMMAND, QUESTION, etc.-->
        <xsd:attribute name="content-type" type="xsd:string" use="required"/> 
        <!-- this instruction is destinated for what agent operation mode? PLAYING, LEARNING, ANY, etc.-->
        <xsd:attribute name="target-mode" type="xsd:string" use="required"/>
    </xsd:complexType>

    <xsd:element name="agent-sensor-info" type="pet:AgentSensorInfoType"/>

    <xsd:annotation>
        <xsd:documentation>
	This type of message is required to provide informations about the agents sensory.
	Sensors like vision and hearing can exchange it's data to OAC via this message type
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="AgentSensorInfoType">
        <xsd:sequence>            
            <xsd:annotation>
                <xsd:documentation>
		Several perceptions may be exchanged in just oe agent sensor info.
		A perception is the signal generated by a specific sensor
                </xsd:documentation>
            </xsd:annotation>
            <xsd:element name="perception" type="pet:SensorPerceptionType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:annotation>
        <xsd:documentation>
	A perception is a data generated by a specific sensor. The subject is a classifier
	of the sensor signal. The signal is the raw data of the sensor's perception
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="SensorPerceptionType">
        <xsd:attribute name="sensor" type="xsd:string" use="required"/>
        <xsd:attribute name="subject" type="xsd:string" use="optional" default=""/>
        <xsd:attribute name="signal" type="xsd:string" use="required"/>
    </xsd:complexType>

    <xsd:element name="map-info" type="pet:MapInfoType"/>

    <xsd:annotation>
        <xsd:documentation>
        Map data aggregated from SecondLife, the goal here will be to provide
        information on which blips are ours.  The map size will be difficult to
        determine as LSL sensors search spherically.  Even though certain 
        pieces of information will be easier to gather on Sheep owned islands
        the limits of LSL will make it difficult to provide a complete "live" map.
        The map data will represent all that is known about a gridParcel at a particular
        time.  Blip coordinates will be global to all simulators (regions).  The 
        gridParcel attribute may not prove useful here, but will remain until I'm certain
        it's not.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="MapInfoType">
        <xsd:sequence>
            <xsd:annotation>
                <xsd:documentation>
                The map data behaves much like a radar screen, a grid with a
                series of blips that represent nearby entities.
                </xsd:documentation>
            </xsd:annotation>
            <xsd:element name="blip" type="pet:BlipType" minOccurs="1" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="global-position-x" type="xsd:int" use="required"/>
        <xsd:attribute name="global-position-y" type="xsd:int" use="required"/>        
        <xsd:attribute name="global-position-offset" type="xsd:int" use="required"/>
        <xsd:attribute name="gridParcel" type="xsd:string" use="optional"/>
    </xsd:complexType>
        
    <xsd:annotation>
        <xsd:documentation>
        Blips on the radar that indicate an entity, its position and the time
        that it was spotted at that location.
        </xsd:documentation>
      </xsd:annotation>

    <xsd:complexType name="BlipType">
        
        <xsd:sequence>
            <xsd:element name="entity" type="pet:EntityType" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="position" type="common:VectorDataType" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="rotation" type="common:RotationDataType" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="velocity" type="common:VectorDataType" minOccurs="1" maxOccurs="1"/>
            <xsd:element name="dimension" type="common:VectorDataType" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="properties" type="pet:PropertiesType" minOccurs="0" maxOccurs="1"/>
         </xsd:sequence>
         
        <xsd:attribute name="timestamp" type="xsd:dateTime" use="required"/>

               <!--
        <xsd:attribute name="detector" type="xsd:boolean" use="optional" default="false">
            <xsd:annotation>
                <xsd:documentation>
                if the detector attribute is true this means that this blip did
                some of the sensing
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="remove" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="visibility-status" type="xsd:string" use="optional" default="non-visible"/>
        <xsd:attribute name="length" type="xsd:double" use="optional" default="0.67"/>
        <xsd:attribute name="width" type="xsd:double" use="optional" default="0.33"/>
        <xsd:attribute name="height" type="xsd:double" use="optional" default="0.5"/>
        <xsd:attribute name="edible" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="drinkable" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="petHome" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="foodBowl" type="xsd:boolean" use="optional" default="false"/>
        <xsd:attribute name="waterBowl" type="xsd:boolean" use="optional" default="false"/>
        -->
    </xsd:complexType>

    <xsd:complexType name="PropertiesType">
        <xsd:sequence>
          <xsd:element name="property" type="pet:PropertyType" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="PropertyType">
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="value" type="xsd:string" use="required"/>
    </xsd:complexType>      


    <xsd:annotation>
        <xsd:documentation>
        The entity id and type will allow for reasonably simple differentiation of 
        pet, pet toys, avatars, and static structures. Owner-id may not be necessary,
        but it could potentially be useful.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType name="EntityType">
        <xsd:complexContent>
            <xsd:extension base="common:BaseEntityType">
                <xsd:sequence>
                    <xsd:element name="metadata" type="pet:ParamType"
                                 minOccurs="0" maxOccurs="unbounded"/>
                </xsd:sequence>
                <xsd:attribute name="name" type="xsd:string" use="optional"/>
                <xsd:attribute name="owner-id" type="xsd:string" use="optional"/>
                <xsd:attribute name="owner-name" type="xsd:string" use="optional"/>
                <xsd:attribute name="session-id" type="xsd:string" use="optional"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:annotation>
        <xsd:documentation><![CDATA[
        All pets will be able to perform some sort of action, whether this action
        is navigation or a simple head-tilt or ear waggle.  To enable complicated
        movements, I've allowed the specification of the action sequence to be
        somewhat open-ended.  In most cases, I imagine the action sequence will 
        look like so:
            <action-plan id="#unique-id#" pet-id"1138">
                <action name="walk" sequence="1">                  
                    <param name="destination" type="vector">
                        <vector x="209.1" y="10.0" z="21.4"/>
                    </param>
                    <param name="speed" type="int" value="30"/>
                </action>
                <action name="fly" sequence="2">
                    // fly approximately 50 meters
                    <param name="destination" type="vector">
                        <vector x="259.1" y="20.0" z="31.4"/>
                    </param
                    // instead of flying in a diagonal line, we
                    // make the flight an arc through space.
                    <param name="arc" type="rotation">
                        <rotation yaw="5" pitch="10" roll="0"/>
                    </param>
                    // speed is in meters/second
                    <param name="speed" type="int" value="60"/>
                </action>
            </action-plan>
        ]]>
        </xsd:documentation>
    </xsd:annotation>
    <xsd:element name="action-plan" type="pet:ActionPlanType"/>
    
    <xsd:complexType name="ActionPlanType">
        <xsd:sequence>
            <xsd:choice minOccurs="1" maxOccurs="unbounded">
                <xsd:element name="parallel" type="pet:ParallelActionType" minOccurs="1" maxOccurs="1"/>
                <xsd:element name="action" type="pet:SequencedActionType" minOccurs="1" maxOccurs="1"/>
            </xsd:choice>           
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:string" use="required"/>
        <xsd:attribute name="entity-id" type="xsd:string" use="required"/>
        <xsd:attribute name="entity-type" type="common:EntityDataType" use="optional" default="pet"/>
    </xsd:complexType>

    <xsd:complexType name="ParamType">
        <xsd:complexContent>
            <xsd:extension base="common:BaseParameterType">
                <xsd:sequence>
                    <xsd:choice minOccurs="0" maxOccurs="1">
                        <xsd:element name="vector" type="common:VectorDataType" minOccurs="1" maxOccurs="1"/>
                        <xsd:element name="rotation" type="common:RotationDataType" minOccurs="1" maxOccurs="1"/>
                        <xsd:element name="entity" type="pet:EntityType" minOccurs="1" maxOccurs="1"/>
                        <xsd:element name="list" type="common:ListDataType" minOccurs="1" maxOccurs="1"/>
                        <xsd:element name="value" type="xsd:string" minOccurs="1" maxOccurs="1"/>
                    </xsd:choice>
                </xsd:sequence>
                <xsd:attribute name="value" type="xsd:string" use="optional"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ActionType">
        <xsd:complexContent>
            <xsd:extension base="common:BaseActionType">
                <xsd:sequence>
                    <xsd:element name="param" type="pet:ParamType" minOccurs="0" maxOccurs="unbounded"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="SequencedActionType">
        <xsd:complexContent>
            <xsd:extension base="pet:ActionType">
                <xsd:sequence/>
                <xsd:attribute name="sequence" type="xsd:positiveInteger" use="required"/>
                <xsd:attribute name="reportable" type="xsd:boolean" use="optional" default="true"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="ParallelActionType">
        <xsd:sequence>
            <xsd:element name="action" type="pet:SequencedActionType" minOccurs="2" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>    
    
    <xsd:simpleType name="StatusType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="done"/>
            <xsd:enumeration value="error"/>
        </xsd:restriction>
    </xsd:simpleType>
        
    <xsd:annotation>
        <xsd:documentation>
            An Entity Metadata element represents a set of attributes that
            describe the entity identified in the "id" field.  The idea
            is to allow attributes to be modified over time, but have a
            document such as this one which will allow others to view that
            metadata as they see fit. Clients of these elements include:
            web portals and the AI router.  These documents may be used to
            describe updates to metadata as well.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:element name="entity-metadata" type="pet:EntityMetadataType"/>

    <xsd:complexType name="EntityMetadataType">
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string"
                         minOccurs="0" maxOccurs="1"/>
            <xsd:element name="attribute" type="pet:SimpleAttribute"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:string" use="required"/>
        <xsd:attribute name="type" type="common:EntityDataType" use="required"/>
    </xsd:complexType>

    <xsd:complexType name="SimpleAttribute">
        <xsd:simpleContent>
            <xsd:extension base="xsd:string">
                <xsd:attribute name="name" type="xsd:string" use="required"/>
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType>

</xsd:schema>

{'fraction_non_alphanumeric': 0.13175969396626674, 'fraction_numerical': 0.005455572943835855, 'mean_word_length': 2.6692718717601083, 'pattern_counts': {'":': 0, '<': 717, '<?xml version=': 2, '>': 715, 'https://': 0, 'lorem ipsum': 0, 'www.': 14, 'xml': 11}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5045464', 'n_tokens_mistral': 13598, 'n_tokens_neox': 12351, 'n_words': 3024}