cpfaff / ease

EASE (Essential Annotation Schema for Ecology)
0 stars 2 forks source link

Replace all Ranges with a more generic construct #9

Closed cpfaff closed 8 years ago

cpfaff commented 8 years ago

Currently with ranges a form of list exists that is created all over the schema again and again with just changing its name to represent the current content. dateTimeRange, organismRange..... This could be done a bit more generic which would prevent repetition of code see the example below.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="item" type="xs:string"/>
  <xs:attribute name="of" type="listType"/>

  <xs:element name="list">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="item"/>
      </xs:sequence>
      <xs:attribute ref="listType"/>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name="listType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="organismNames"/>
      <xs:enumeration value="locationNames"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>

This then allows to write

<list of="locationNames">
  <item>string</item>
</list>