<?xml version="1.0" encoding="US-ASCII"?>

<!-- $Id: ldsml.dtd,v 1.9 2002/07/16 20:48:25 flacoste Exp $ -->

<!--

Copyright (C) 2001 Stichting LogReport Foundation LogReport@LogReport.org
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
     
You should have received a copy of the GNU General Public License
along with this program (see COPYING); if not, check with
http://www.gnu.org/copyleft/gpl.html or write to the Free Software 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.

-->

<!--                    
    Document Type Definition for the Lire DLF Schema Markup Language.

    Please use the following formal public identifier to identify it:

    "-//LogReport.ORG//DTD Lire DLF Schema Markup Language V1.0//EN"

    This DTD defines a grammar that is used to define the schema
    of the DLF files.

    NameSpace:

    Elements of this DTD are defined in the namespace
    http://www.logreport.org/LDSML/

    The official URL for this DTD is 
    http://www.logreport.org/LDSML/1.0/ldsml.dtd

    XML documents should reference this DTD by using

    DOCTYPE PUBLIC
   "-//LogReport.ORG//DTD Lire DLF Schema Markup Language V1.0//EN"
   "http://www.logreport.org/LDSML/1.0/ldsml.dtd"
                                                                   -->

<!--                    Namespace prefix for validation using the
                        DTD                                        -->
<!ENTITY % LIRE.xmlns.pfx    "lire"                                  >
<!ENTITY % LIRE.pfx          "%LIRE.xmlns.pfx;:"                     >
<!ENTITY % LIRE.xmlns.attr.name "xmlns:%LIRE.xmlns.pfx;"             >
<!ENTITY % LIRE.xmlns.attr
  "%LIRE.xmlns.attr.name; CDATA #FIXED 'http://www.logreport.org/LDSML/'">

<!-- 
    Include needed modules
                                                                   -->
<!ENTITY % lire-types.mod PUBLIC
    "-//LogReport.ORG//ENTITIES Lire Data Types V1.0//EN"
    "lire-types.mod">
%lire-types.mod;

<!ENTITY % lire-desc.mod PUBLIC
    "-//LogReport.ORG//ELEMENTS Lire Description Elements V1.0//EN"
    "lire-desc.mod">
%lire-desc.mod;

<!-- Prefixed names declaration.                                   -->
<!ENTITY % LIRE.dlf-schema   "%LIRE.pfx;dlf-schema"                  >
<!ENTITY % LIRE.extended-schema "%LIRE.pfx;extended-schema"          >
<!ENTITY % LIRE.derived-schema  "%LIRE.pfx;derived-schema"           >
<!ENTITY % LIRE.field        "%LIRE.pfx;field"                       >

<!--
    Dlf-schema element.

    This is the root element of a DLF Schema. It contains an optional
    title, an optional description and one or more field
    specifications.

    The order of the field is specified by the order of the field
    elements in the DLF schema document.

    Attributes of dlf-schema :
        superservice:   the superservice DLF schema which is defined.
        timestamp:      the name of the field which is the default
                        timestamp field providing the default sort
                        order of the records.
                                                                   -->
<!ELEMENT %LIRE.dlf-schema;  ( (%LIRE.title;)?, (%LIRE.description;)?,
                               (%LIRE.field;)+ )                     >
<!ATTLIST %LIRE.dlf-schema;
             superservice    %superservice.type;           #REQUIRED
             timestamp       IDREF                         #REQUIRED 
             %LIRE.xmlns.attr;                                       >

<!--
    Extended-schema element.

    This is the root element of an extended DLF Schema. Extended-schema
    defines additional fields that will be added to the base schema.
    It contains an optional title, an optional description and one or
    more field specifications.

    Example of an extended-schema would be 'www-user_agent' which would
    adds several fields (browser, os, lang, robot) computed fromt the
    user_agent field.

    The order of the field is specified by the order of the field
    elements in the DLF schema document.

    Attributes of dlf-schema :
        id:             the identifier for this schema
        base-schema:    the name of the schema that is extended
        required-fields: Space delimited list of the fields of the 
                        base-schema  that must be available to use
                        this schema.
        module:         the name of the module which will be used to
                        generate the extended fields
                                                                   -->
<!ELEMENT %LIRE.extended-schema; 
                             ( (%LIRE.title;)?, (%LIRE.description;)?,
                               (%LIRE.field;)+ )                     >
<!ATTLIST %LIRE.extended-schema;
             id              NMTOKEN                       #REQUIRED
             base-schema     NMTOKEN                       #REQUIRED
             module          NMTOKEN                       #REQUIRED 
             required-fields NMTOKENS                      #IMPLIED
             %LIRE.xmlns.attr;                                       >

<!--
    Derived-schema element.

    This is the root element of a derived DLF Schema. The difference
    between a normal schema and a derived schema is that the data is
    generated from another DLF instead of a log file. 

    Example of a derived-schema would be 'www-user_session' which 
    defines a schema for user www session and from which the data is
    generated from a www DLF.

    The order of the field is specified by the order of the field
    elements in the DLF schema document.

    Attributes of dlf-schema :
        id:             the identifier for this schema
        base-schema:    the schema's name of the data from which this
                        schema's data will be computed
        module:         the name of the module which will be used to
                        compute the derived DLF records.
        required-fields: Space delimited list of the fields of the 
                        base-schema  that must be available to use
                        this schema.
        timestamp:      the name of the field which is the default
                        timestamp field providing the default sort
                        order of the records.
                                                                   -->
<!ELEMENT %LIRE.derived-schema; 
                             ( (%LIRE.title;)?, (%LIRE.description;)?,
                               (%LIRE.field;)+ )                     >
<!ATTLIST %LIRE.derived-schema;
             id              NMTOKEN                       #REQUIRED
             base-schema     NMTOKEN                       #REQUIRED
             module          NMTOKEN                       #REQUIRED 
             required-fields NMTOKENS                      #IMPLIED
             timestamp       IDREF                         #REQUIRED 
             %LIRE.xmlns.attr;                                       >

<!--
    Field element.

    This element defines a field in the DLF file. 

    Attribute of field:
        name:           the name of the field.
        type:           the data type of the field.
        default:        the default value of the field when it cannot
                        be determined from the logfile.
                                                                   -->
<!ELEMENT %LIRE.field;       (%LIRE.description;)?                   >
<!ATTLIST %LIRE.field;
             name            ID                            #REQUIRED
             type            (%lire.types;)                #REQUIRED
             default         CDATA                         #IMPLIED  >

