<?xml version="1.0" encoding="UTF-8"?>
<!-- The RIS XML DTD - a XML application based on the RIS reference format -->
<!-- (C) 2003-03-22 Markus Hoenicka <markus@mhoenicka.de> -->
<!-- Invoke with the following declaration -->
<!-- <!DOCTYPE ris PUBLIC "-//Markus Hoenicka//DTD Ris V1.3.0//EN" "http://refdb.sourceforge.net/dtd/risx-1.3.0/risx.dtd"> -->
<!-- the top-level element -->
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <define name="ris">
    <element name="ris">
      <ref name="attlist.ris"/>
      <oneOrMore>
        <ref name="entry"/>
      </oneOrMore>
    </element>
  </define>
  <define name="attlist.ris" combine="interleave">
    <empty/>
  </define>
  <!-- each RIS dataset is encoded by the following structure: -->
  <!-- part, publication, and set denote the analytical, monographic, and -->
  <!-- serial level of bibliographic information. -->
  <!-- libinfo contains all information relevant for local housekeeping -->
  <!-- contents describes the contents of the reference described by the -->
  <!-- dataset -->
  <!-- the type attribute is equivalent to the TY RIS field -->
  <!-- the identifier attributes: ID is a numeric one, while citekey is an -->
  <!-- alphanumeric key. Both are supposed to be unique in a database -->
  <!-- note to self: why was there a "+"? -->
  <!-- <!ELEMENT entry (part?,publication,set?,libinfo*,contents?)+> -->
  <define name="entry">
    <element name="entry">
      <ref name="attlist.entry"/>
      <optional>
        <ref name="part"/>
      </optional>
      <ref name="publication"/>
      <optional>
        <ref name="set"/>
      </optional>
      <zeroOrMore>
        <ref name="libinfo"/>
      </zeroOrMore>
      <optional>
        <ref name="contents"/>
      </optional>
    </element>
  </define>
  <define name="attlist.entry" combine="interleave">
    <optional>
      <attribute name="type" a:defaultValue="GEN">
        <choice>
          <value>ABST</value>
          <value>ADVS</value>
          <value>ART</value>
          <value>BILL</value>
          <value>BOOK</value>
          <value>CASE</value>
          <value>CHAP</value>
          <value>COMP</value>
          <value>CONF</value>
          <value>CTLG</value>
          <value>DATA</value>
          <value>ELEC</value>
          <value>GEN</value>
          <value>HEAR</value>
          <value>ICOMM</value>
          <value>INPR</value>
          <value>JFULL</value>
          <value>JOUR</value>
          <value>MAP</value>
          <value>MGZN</value>
          <value>MPCT</value>
          <value>MUSIC</value>
          <value>NEWS</value>
          <value>PAMP</value>
          <value>PAT</value>
          <value>PCOMM</value>
          <value>RPRT</value>
          <value>SER</value>
          <value>SLIDE</value>
          <value>SOUND</value>
          <value>STAT</value>
          <value>THES</value>
          <value>UNBILL</value>
          <value>UNPB</value>
          <value>VIDEO</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="id">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="citekey">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
  </define>
  <!-- the three levels of bibliographic information -->
  <define name="part">
    <element name="part">
      <ref name="attlist.part"/>
      <ref name="title"/>
      <zeroOrMore>
        <ref name="author"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="attlist.part" combine="interleave">
    <empty/>
  </define>
  <define name="publication">
    <element name="publication">
      <ref name="attlist.publication"/>
      <zeroOrMore>
        <ref name="title"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="author"/>
      </zeroOrMore>
      <optional>
        <ref name="pubinfo"/>
      </optional>
    </element>
  </define>
  <define name="attlist.publication" combine="interleave">
    <empty/>
  </define>
  <define name="set">
    <element name="set">
      <ref name="attlist.set"/>
      <zeroOrMore>
        <ref name="title"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="author"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="attlist.set" combine="interleave">
    <empty/>
  </define>
  <!-- the apparatus used in the bibliographic information -->
  <define name="title">
    <element name="title">
      <ref name="attlist.title"/>
      <text/>
    </element>
  </define>
  <define name="attlist.title" combine="interleave">
    <optional>
      <attribute name="type" a:defaultValue="full">
        <choice>
          <value>full</value>
          <value>abbrev</value>
          <value>user1</value>
          <value>user2</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="freq">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="relfreq">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
  </define>
  <!-- The url element is gone in favour of 'link type="url"'. Both elements use the same semantics so it would be weird to keep them separately -->
  <define name="pubinfo">
    <element name="pubinfo">
      <ref name="attlist.pubinfo"/>
      <zeroOrMore>
        <ref name="pubdate"/>
      </zeroOrMore>
      <optional>
        <ref name="volume"/>
      </optional>
      <optional>
        <ref name="issue"/>
      </optional>
      <optional>
        <ref name="conftitle"/>
      </optional>
      <optional>
        <ref name="startpage"/>
      </optional>
      <optional>
        <ref name="endpage"/>
      </optional>
      <optional>
        <ref name="city"/>
      </optional>
      <optional>
        <ref name="publisher"/>
      </optional>
      <optional>
        <ref name="serial"/>
      </optional>
      <optional>
        <ref name="address"/>
      </optional>
      <zeroOrMore>
        <ref name="userdef"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="misc"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="link"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="attlist.pubinfo" combine="interleave">
    <empty/>
  </define>
  <define name="pubdate">
    <element name="pubdate">
      <ref name="attlist.pubdate"/>
      <ref name="date"/>
      <optional>
        <ref name="otherinfo"/>
      </optional>
    </element>
  </define>
  <define name="attlist.pubdate" combine="interleave">
    <optional>
      <attribute name="type" a:defaultValue="primary">
        <choice>
          <value>primary</value>
          <value>secondary</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="date">
    <element name="date">
      <ref name="attlist.date"/>
      <optional>
        <ref name="year"/>
      </optional>
      <optional>
        <ref name="month"/>
      </optional>
      <optional>
        <ref name="day"/>
      </optional>
    </element>
  </define>
  <define name="attlist.date" combine="interleave">
    <empty/>
  </define>
  <define name="year">
    <element name="year">
      <ref name="attlist.year"/>
      <text/>
    </element>
  </define>
  <define name="attlist.year" combine="interleave">
    <empty/>
  </define>
  <define name="month">
    <element name="month">
      <ref name="attlist.month"/>
      <text/>
    </element>
  </define>
  <define name="attlist.month" combine="interleave">
    <empty/>
  </define>
  <define name="day">
    <element name="day">
      <ref name="attlist.day"/>
      <text/>
    </element>
  </define>
  <define name="attlist.day" combine="interleave">
    <empty/>
  </define>
  <define name="otherinfo">
    <element name="otherinfo">
      <ref name="attlist.otherinfo"/>
      <text/>
    </element>
  </define>
  <define name="attlist.otherinfo" combine="interleave">
    <empty/>
  </define>
  <define name="volume">
    <element name="volume">
      <ref name="attlist.volume"/>
      <text/>
    </element>
  </define>
  <define name="attlist.volume" combine="interleave">
    <empty/>
  </define>
  <define name="issue">
    <element name="issue">
      <ref name="attlist.issue"/>
      <text/>
    </element>
  </define>
  <define name="attlist.issue" combine="interleave">
    <empty/>
  </define>
  <define name="conftitle">
    <element name="conftitle">
      <ref name="attlist.conftitle"/>
      <text/>
    </element>
  </define>
  <define name="attlist.conftitle" combine="interleave">
    <empty/>
  </define>
  <define name="startpage">
    <element name="startpage">
      <ref name="attlist.startpage"/>
      <text/>
    </element>
  </define>
  <define name="attlist.startpage" combine="interleave">
    <empty/>
  </define>
  <define name="endpage">
    <element name="endpage">
      <ref name="attlist.endpage"/>
      <text/>
    </element>
  </define>
  <define name="attlist.endpage" combine="interleave">
    <empty/>
  </define>
  <define name="city">
    <element name="city">
      <ref name="attlist.city"/>
      <text/>
    </element>
  </define>
  <define name="attlist.city" combine="interleave">
    <empty/>
  </define>
  <define name="publisher">
    <element name="publisher">
      <ref name="attlist.publisher"/>
      <text/>
    </element>
  </define>
  <define name="attlist.publisher" combine="interleave">
    <empty/>
  </define>
  <define name="serial">
    <element name="serial">
      <ref name="attlist.serial"/>
      <text/>
    </element>
  </define>
  <define name="attlist.serial" combine="interleave">
    <empty/>
  </define>
  <define name="address">
    <element name="address">
      <ref name="attlist.address"/>
      <text/>
    </element>
  </define>
  <define name="attlist.address" combine="interleave">
    <empty/>
  </define>
  <define name="userdef">
    <element name="userdef">
      <ref name="attlist.userdef"/>
      <text/>
    </element>
  </define>
  <define name="attlist.userdef" combine="interleave">
    <optional>
      <attribute name="type" a:defaultValue="1">
        <choice>
          <value>1</value>
          <value>2</value>
          <value>3</value>
          <value>4</value>
          <value>5</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="misc">
    <element name="misc">
      <ref name="attlist.misc"/>
      <text/>
    </element>
  </define>
  <define name="attlist.misc" combine="interleave">
    <optional>
      <attribute name="type" a:defaultValue="1">
        <choice>
          <value>1</value>
          <value>2</value>
          <value>3</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="link">
    <element name="link">
      <ref name="attlist.link"/>
      <text/>
    </element>
  </define>
  <define name="attlist.link" combine="interleave">
    <optional>
      <attribute name="type" a:defaultValue="url">
        <choice>
          <value>url</value>
          <value>pdf</value>
          <value>fulltext</value>
          <value>related</value>
          <value>image</value>
          <value>doi</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <!-- the libinfo element contains the local housekeeping information -->
  <!-- specific to a single user -->
  <define name="libinfo">
    <element name="libinfo">
      <ref name="attlist.libinfo"/>
      <optional>
        <ref name="notes"/>
      </optional>
      <ref name="reprint"/>
      <optional>
        <ref name="availability"/>
      </optional>
      <zeroOrMore>
        <ref name="link"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="attlist.libinfo" combine="interleave">
    <attribute name="user">
      <data type="NMTOKEN"/>
    </attribute>
  </define>
  <define name="notes">
    <element name="notes">
      <ref name="attlist.notes"/>
      <text/>
    </element>
  </define>
  <define name="attlist.notes" combine="interleave">
    <empty/>
  </define>
  <define name="reprint">
    <element name="reprint">
      <ref name="attlist.reprint"/>
      <optional>
        <ref name="date"/>
      </optional>
    </element>
  </define>
  <define name="attlist.reprint" combine="interleave">
    <optional>
      <attribute name="status" a:defaultValue="NOTINFILE">
        <choice>
          <value>NOTINFILE</value>
          <value>ONREQUEST</value>
          <value>INFILE</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="availability">
    <element name="availability">
      <ref name="attlist.availability"/>
      <text/>
    </element>
  </define>
  <define name="attlist.availability" combine="interleave">
    <optional>
      <attribute name="type" a:defaultValue="full">
        <choice>
          <value>full</value>
          <value>useroot</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <!-- the contents element contains information about the contents of -->
  <!-- the reference -->
  <define name="contents">
    <element name="contents">
      <ref name="attlist.contents"/>
      <optional>
        <ref name="abstract"/>
      </optional>
      <zeroOrMore>
        <ref name="keyword"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="attlist.contents" combine="interleave">
    <empty/>
  </define>
  <define name="abstract">
    <element name="abstract">
      <ref name="attlist.abstract"/>
      <text/>
    </element>
  </define>
  <define name="attlist.abstract" combine="interleave">
    <empty/>
  </define>
  <define name="keyword">
    <element name="keyword">
      <ref name="attlist.keyword"/>
      <text/>
    </element>
  </define>
  <define name="attlist.keyword" combine="interleave">
    <optional>
      <attribute name="freq">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="relfreq">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
  </define>
  <!-- the author element -->
  <define name="author">
    <element name="author">
      <ref name="attlist.author"/>
      <choice>
        <ref name="name"/>
        <group>
          <optional>
            <ref name="lastname"/>
          </optional>
          <optional>
            <ref name="firstname"/>
          </optional>
          <zeroOrMore>
            <ref name="middlename"/>
          </zeroOrMore>
          <optional>
            <ref name="suffix"/>
          </optional>
        </group>
      </choice>
    </element>
  </define>
  <define name="attlist.author" combine="interleave">
    <optional>
      <attribute name="role">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="freq">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="relfreq">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
  </define>
  <define name="name">
    <element name="name">
      <ref name="attlist.name"/>
      <text/>
    </element>
  </define>
  <define name="attlist.name" combine="interleave">
    <empty/>
  </define>
  <define name="lastname">
    <element name="lastname">
      <ref name="attlist.lastname"/>
      <text/>
    </element>
  </define>
  <define name="attlist.lastname" combine="interleave">
    <empty/>
  </define>
  <define name="firstname">
    <element name="firstname">
      <ref name="attlist.firstname"/>
      <text/>
    </element>
  </define>
  <define name="attlist.firstname" combine="interleave">
    <empty/>
  </define>
  <define name="middlename">
    <element name="middlename">
      <ref name="attlist.middlename"/>
      <text/>
    </element>
  </define>
  <define name="attlist.middlename" combine="interleave">
    <empty/>
  </define>
  <define name="suffix">
    <element name="suffix">
      <ref name="attlist.suffix"/>
      <text/>
    </element>
  </define>
  <define name="attlist.suffix" combine="interleave">
    <empty/>
  </define>
  <start>
    <choice>
      <ref name="ris"/>
    </choice>
  </start>
</grammar>
