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

<!-- XML schema for LOGML 1.0 -->
<!-- Authors: John Punin, Mukkai Krishnamoorthy and Gerard Uffelman -->
<!-- Computer Science Department -->
<!-- Rensselaer Polytechnic Institute -->
<!-- logml.xsd,v 1.0 06/22/2001 -->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	targetNamespace="http://www.cs.rpi.edu/LOGML" 
	xmlns:xml="http://www.w3.org/XML/1998/namespace"
	xmlns:xgmml="http://www.cs.rpi.edu/XGMML" 
	xmlns:lml="http://www.cs.rpi.edu/LOGML" 
	xmlns="http://www.cs.rpi.edu/LOGML" 
	elementFormDefault="qualified"
	attributeFormDefault="unqualified"
	version="logml 1.0">

<!-- get access to the xml: attribute groups for xml:lang -->
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" 
	schemaLocation="http://www.w3.org/2001/xml.xsd"/>

<xsd:import namespace="http://www.cs.rpi.edu/XGMML" 
	schemaLocation="http://www.cs.rpi.edu/~puninj/XGMML/xgmml.xsd"/>

<!-- Boolean type -->
<xsd:simpleType name="boolean.type">
 <xsd:restriction base="xgmml:boolean.type"/>
</xsd:simpleType>

<!-- Positive number type -->
<xsd:simpleType name="number.type">
  <xsd:restriction base="xgmml:number.type"/>
</xsd:simpleType>

<!-- Token type -->
<xsd:simpleType name="nmtoken.type">
  <xsd:restriction base="xsd:NMTOKEN"/>
</xsd:simpleType>

<!-- ID type -->
<xsd:simpleType name="id.type">
  <xsd:restriction base="xgmml:id.type"/>
</xsd:simpleType>

<!-- IDREF type -->
<xsd:simpleType name="idref.type">
  <xsd:restriction base="xgmml:idref.type"/>
</xsd:simpleType>

<!-- String type -->
<xsd:simpleType name="string.type">
  <xsd:restriction base="xgmml:string.type"/>
</xsd:simpleType>

<!-- URI type -->
<xsd:simpleType name="uri.type">
  <xsd:restriction base="xsd:anyURI"/>
</xsd:simpleType>

<!--Date Type-->
<xsd:simpleType name="date.type">
  <xsd:restriction base="xsd:string"/>
</xsd:simpleType>

<!-- Global Attributes -->

<xsd:attributeGroup name="lml-global-atts">
		<xsd:attribute name="id" type="id.type"/>
		<xsd:attribute name="name" type="string.type"/>
		<xsd:attribute name="label" type="string.type"/>
</xsd:attributeGroup>

<!-- Global Required Attributes -->
<xsd:attributeGroup name="lml-global-req-atts">
		<xsd:attribute name="id" type="id.type" use="required"/>
		<xsd:attribute name="name" type="string.type"/>
		<xsd:attribute name="label" type="string.type"/>
</xsd:attributeGroup>

<!-- Standard XML Attributes -->
<xsd:attributeGroup name="xml-atts">
		<xsd:attribute ref="xml:lang"/>
		<xsd:attribute ref="xml:space"/>
</xsd:attributeGroup>

<!-- XGMML Attributes -->
<xsd:attributeGroup name="xgmml-atts">
		<xsd:attribute name="weight" type="string.type"/>
</xsd:attributeGroup>

<!-- General Access Log Attributes -->
<xsd:attributeGroup name="log-acc-atts">
		<xsd:attribute name="access_count" type="number.type"/>
		<xsd:attribute name="bytes" type="number.type"/>
		<xsd:attribute name="html_pages" type="number.type"/>
</xsd:attributeGroup>


<!-- General Hit Log Attributes -->
<xsd:attributeGroup name="log-hit-atts">
		<xsd:attribute name="hits" type="number.type"/>
		<xsd:attribute name="bytes" type="number.type"/>
		<xsd:attribute name="html_pages" type="number.type"/>
</xsd:attributeGroup>


<!-- General Count Log Attributes -->
<xsd:attributeGroup name="log-count-atts">
		<xsd:attribute name="total_count" type="number.type"/>
		<xsd:attribute name="bytes" type="number.type"/>
		<xsd:attribute name="html_pages" type="number.type"/>
</xsd:attributeGroup>

<!-- Counter of Elements Attribute -->
<xsd:attributeGroup name="count-att">
		<xsd:attribute name="count" type="number.type"/>
</xsd:attributeGroup>

<!--ROOT ELEMENT-->
<!--================================================================-->

<xsd:complexType name="logmlType">
     <xsd:sequence>
        <xsd:element ref="graph" minOccurs="1" maxOccurs="1"/>
        <xsd:element ref="hosts" minOccurs="0" maxOccurs="1"/>
        <xsd:element ref="domains" minOccurs="0" maxOccurs="1"/>
        <xsd:element ref="directories" minOccurs="0" maxOccurs="1"/>
        <xsd:element ref="userAgents" minOccurs="0" maxOccurs="1"/>
        <xsd:element ref="hostReferers" minOccurs="0" maxOccurs="1"/>
        <xsd:element ref="referers" minOccurs="0" maxOccurs="1"/>
        <xsd:element ref="keywords" minOccurs="0" maxOccurs="unbounded"/>
        <xsd:element ref="summary" minOccurs="0" maxOccurs="1"/>
        <xsd:element ref="userSessions" minOccurs="0" maxOccurs="1"/>
     </xsd:sequence>
       <xsd:attributeGroup ref="lml-global-atts"/>
       <xsd:attributeGroup ref="xml-atts"/>
       <xsd:attribute name="start_date" type="date.type" use="required"/>
       <xsd:attribute name="end_date" type="date.type" use="required"/>
</xsd:complexType>

<xsd:element name="logml" type="logmlType"/>


<!--WEBSITE INFORMATION-->
<!--================================================================-->

<xsd:complexType name="simpleLogGraph">
   <xsd:complexContent>
      <xsd:restriction base="xgmml:simpleGraph">
         <xsd:sequence>
            <xsd:element ref="att" minOccurs="0" maxOccurs="unbounded"/>
	    <xsd:choice minOccurs="0" maxOccurs="unbounded">
	        <xsd:element ref="node"/>
		<xsd:element ref="edge"/>
            </xsd:choice>
         </xsd:sequence>
           <xsd:attributeGroup ref="lml-global-atts"/>
	   <xsd:attribute name="directed" type="boolean.type"/>
      </xsd:restriction>
   </xsd:complexContent>
</xsd:complexType>

<!-- Graph Element -->
<xsd:element name="graph" type="simpleLogGraph"/>

<xsd:complexType name="simpleLogNode">
   <xsd:complexContent>
      <xsd:extension base="xgmml:simpleNode">
         <xsd:sequence>
            <xsd:element ref="att" minOccurs="0" maxOccurs="unbounded"/>
         </xsd:sequence>
	   <xsd:attribute name="hits" type="number.type"/>
	   <xsd:attribute name="ehits" type="number.type"/>
	   <xsd:attribute name="indp" type="boolean.type"/>
      </xsd:extension>
   </xsd:complexContent>
</xsd:complexType>

<!-- Node Element -->
<xsd:element name="node" type="simpleLogNode"/>


<!-- Edge Attributes (GML) -->
<xsd:attributeGroup name="edge-atts">
    <xsd:attribute name="source" type="idref.type" use="required"/>
    <xsd:attribute name="target" type="idref.type" use="required"/>
</xsd:attributeGroup>

<xsd:complexType name="simpleLogEdge">
   <xsd:complexContent>
      <xsd:extension base="xgmml:simpleEdge">
         <xsd:sequence>
            <xsd:element ref="att" minOccurs="0" maxOccurs="unbounded"/>
         </xsd:sequence>
	   <xsd:attribute name="hits" type="number.type"/>
	   <xsd:attribute name="indp" type="boolean.type"/>
      </xsd:extension>
   </xsd:complexContent>
</xsd:complexType>

<!-- Edge Element -->
<xsd:element name="edge" type="simpleLogEdge"/>

<!-- Att Element -->
<xsd:element name="att">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="att" minOccurs="0" maxOccurs="unbounded"/>
       </xsd:sequence>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attribute name="value" type="string.type"/>
     </xsd:complexType>
</xsd:element>

<!--HOST INFORMATION-->
<!--================================================================-->

<xsd:element name="hosts">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="host" minOccurs="1" maxOccurs="unbounded"/>
       </xsd:sequence>
	 <xsd:attributeGroup ref="count-att"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="host">
     <xsd:complexType>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attribute name="ip" type="string.type"/>
	 <xsd:attribute name="is_internal" type="boolean.type"/>
	 <xsd:attributeGroup ref="log-acc-atts"/>
     </xsd:complexType>
</xsd:element>

<!--DOMAIN INFORMATION-->
<!--================================================================-->

<xsd:element name="domains">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="domain" minOccurs="1" maxOccurs="unbounded"/>
       </xsd:sequence>
	 <xsd:attributeGroup ref="count-att"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="domain">
     <xsd:complexType>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attributeGroup ref="log-acc-atts"/>
     </xsd:complexType>
</xsd:element>

<!--DIRECTORY INFORMATION-->
<!--================================================================-->

<xsd:element name="directories">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="directory" minOccurs="1" maxOccurs="unbounded"/>
       </xsd:sequence>
	 <xsd:attributeGroup ref="count-att"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="directory">
     <xsd:complexType>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attribute name="total_count" type="number.type"/>
	 <xsd:attributeGroup ref="log-acc-atts"/>
     </xsd:complexType>
</xsd:element>

<!--USER AGENT INFORMATION-->
<!--================================================================-->

<xsd:element name="userAgents">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="userAgent" minOccurs="1" maxOccurs="unbounded"/>
       </xsd:sequence>
	 <xsd:attributeGroup ref="count-att"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="userAgent">
     <xsd:complexType>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attributeGroup ref="log-acc-atts"/>
	 <xsd:attribute name="is_spider" type="boolean.type"/>
     </xsd:complexType>
</xsd:element>

<!--REFERER INFORMATION-->
<!--================================================================-->

<xsd:element name="referers">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="referer" minOccurs="1" maxOccurs="unbounded"/>
       </xsd:sequence>
	 <xsd:attributeGroup ref="count-att"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="referer">
     <xsd:complexType>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attribute name="target" type="idref.type"/>
	 <xsd:attributeGroup ref="log-acc-atts"/>
	 <xsd:attribute name="is_internal" type="boolean.type"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="hostReferers">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="hostReferer" minOccurs="1" maxOccurs="unbounded"/>
       </xsd:sequence>
	 <xsd:attributeGroup ref="count-att"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="hostReferer">
     <xsd:complexType>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attributeGroup ref="log-acc-atts"/>
	 <xsd:attribute name="is_search_engine" type="boolean.type"/>
     </xsd:complexType>
</xsd:element>

<!--KEYWORD INFORMATION-->
<!--================================================================-->

<xsd:element name="keywords">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="keyword" minOccurs="1" maxOccurs="unbounded"/>
       </xsd:sequence>
	 <xsd:attribute name="search_engine_name" type="string.type"/>
	 <xsd:attribute name="search_count" type="number.type"/>
	 <xsd:attributeGroup ref="count-att"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="keyword">
     <xsd:complexType>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attribute name="total_count" type="number.type"/>
     </xsd:complexType>
</xsd:element>


<!--GENERAL STATISTICS INFORMATION-->
<!--================================================================-->
<xsd:element name="summary">
     <xsd:complexType>
       <xsd:sequence>
	<xsd:choice minOccurs="0" maxOccurs="unbounded"> 
            <xsd:element ref="att"/>
	    <xsd:element ref="httpCode"/>
	    <xsd:element ref="httpMethod"/>
	    <xsd:element ref="httpVersion"/>
	 </xsd:choice>
	 <xsd:element ref="dateStat" minOccurs="0" maxOccurs="1"/>
       </xsd:sequence>
       <xsd:attribute name="requests" type="number.type"/>
       <xsd:attribute name="sessions" type="number.type"/>
       <xsd:attribute name="bytes" type="number.type"/>
       <xsd:attribute name="html_pages" type="number.type"/>
       <xsd:attribute name="nhtml_pages" type="number.type"/>
       <xsd:attribute name="inline_objects" type="number.type"/>
       <xsd:attribute name="hyperlink_html" type="number.type"/>
       <xsd:attribute name="hyperlink_nhtml" type="number.type"/>
       <xsd:attribute name="html_entry_pages" type="number.type"/>
       <xsd:attribute name="nhtml_entry_pages" type="number.type"/>
       <xsd:attribute name="unique_sites" type="number.type"/>
       <xsd:attribute name="unique_host_referers" type="number.type"/>
       <xsd:attribute name="unique_se_referers" type="number.type"/>
       <xsd:attribute name="unique_external_url_referers" type="number.type"/>
       <xsd:attribute name="unique_internal_url_referers" type="number.type"/>
       <xsd:attribute name="unique_user_agents" type="number.type"/>
       <xsd:attribute name="requests_hour" type="xsd:double"/>
       <xsd:attribute name="requests_day" type="xsd:double"/>
       <xsd:attribute name="kbytes_day" type="xsd:double"/>
       <xsd:attribute name="kbytes_hour" type="xsd:double"/>
       <xsd:attribute name="searches" type="number.type"/>
       <xsd:attribute name="unique_keywords" type="number.type"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="httpCode">
     <xsd:complexType>
	 <xsd:attribute name="code" type="number.type"/>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attributeGroup ref="log-count-atts"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="httpMethod">
     <xsd:complexType>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attributeGroup ref="log-count-atts"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="httpVersion">
     <xsd:complexType>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attributeGroup ref="log-count-atts"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="dateStat">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:choice minOccurs="1" maxOccurs="unbounded"> 
            <xsd:element ref="monthStat"/>
	    <xsd:element ref="dayStat"/>
	    <xsd:element ref="hourStat"/>
	 </xsd:choice>
       </xsd:sequence>
     </xsd:complexType>
</xsd:element>

<xsd:element name="monthStat">
     <xsd:complexType>
	 <xsd:attribute name="month" type="nmtoken.type"/>
	 <xsd:attributeGroup ref="log-hit-atts"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="dayStat">
     <xsd:complexType>
	 <xsd:attribute name="day" type="nmtoken.type"/>
	 <xsd:attributeGroup ref="log-hit-atts"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="hourStat">
     <xsd:complexType>
	 <xsd:attribute name="hour" type="nmtoken.type"/>
	 <xsd:attributeGroup ref="log-hit-atts"/>
     </xsd:complexType>
</xsd:element>

<!--USER SESSION INFORMATION-->
<!--================================================================-->

<xsd:element name="userSessions">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="userSession" minOccurs="1" maxOccurs="unbounded"/>
       </xsd:sequence>
	 <xsd:attributeGroup ref="count-att"/>
	 <xsd:attribute name="max_edges" type="number.type"/>
	 <xsd:attribute name="min_edges" type="number.type"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="userSession">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="path" minOccurs="1" maxOccurs="1"/>
       </xsd:sequence>
	 <xsd:attributeGroup ref="lml-global-atts"/>
	 <xsd:attribute name="ureferer" type="uri.type"/>
	 <xsd:attribute name="entry_page" type="uri.type"/>
	 <xsd:attribute name="start_time" type="date.type"/>
	 <xsd:attribute name="access_count" type="number.type"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="path">
     <xsd:complexType>
       <xsd:sequence>
	 <xsd:element ref="uedge" minOccurs="1" maxOccurs="unbounded"/>
       </xsd:sequence>
	 <xsd:attributeGroup ref="count-att"/>
     </xsd:complexType>
</xsd:element>

<xsd:element name="uedge">
     <xsd:complexType>
	 <xsd:attributeGroup ref="edge-atts"/>
	 <xsd:attribute name="utime" type="date.type"/>
     </xsd:complexType>
</xsd:element>

</xsd:schema>





