[osis-core] test regex
Patrick Durusau
osis-core@bibletechnologieswg.org
Thu, 19 Feb 2004 17:55:59 -0500
This is a multi-part message in MIME format.
--------------050007040906090007090405
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Guys,
Decided to do the regex before breaking for dinner. Validates but had
not run test cases on it.
Enjoy!
Patrick
--
Patrick Durusau
Director of Research and Development
Society of Biblical Literature
Patrick.Durusau@sbl-site.org
Chair, V1 - Text Processing: Office and Publishing Systems Interface
Co-Editor, ISO 13250, Topic Maps -- Reference Model
Topic Maps: Human, not artificial, intelligence at work!
--------------050007040906090007090405
Content-Type: text/xml;
name="regex.xsd"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="regex.xsd"
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified">
<xs:annotation>
<xs:documentation>
<p>This is the OSIS schema for checking regex expressions. The base element is <text> which can be followed by an unlimited number of <p> elements which may have attributes of osisWork, osisID and osisRef, which are the three main regex expressions in the OSIS schema.</p>
</xs:documentation>
</xs:annotation>
<xs:element name="text">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element ref="div"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="div">
<xs:complexType>
<xs:sequence>
<xs:element ref="head" maxOccurs="1"/>
<xs:element ref="p" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="type" type="divType" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="head">
<xs:complexType mixed="true"/>
</xs:element>
<xs:element name="p">
<xs:complexType mixed="true">
<xs:attribute name="osisID" type="osisIDType" use="optional"/>
<xs:attribute name="osisRef" type="osisRefType" use="optional"/>
<xs:attribute name="date" type="osisDateType" use="optional"/>
<xs:attribute name="osisGen" type="osisGenType"
use="optional"/>
<xs:attribute name="annotateRef" type="annotateRefType"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="osisGenType">
<xs:list itemType="osisGenRegex"/>
</xs:simpleType>
<xs:simpleType name="osisGenRegex">
<xs:restriction base="xs:string">
<xs:pattern value="((((\p{L}|\p{N}|_)+)(\.(\p{L}|\p{N}|_))*:)((((\p{L})|(\p{N})|_)+)(((\.(\p{L}|\p{N}|_|(\\[^\s]))+)*))?))"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="osisIDType">
<xs:list itemType="osisIDRegex"/>
</xs:simpleType>
<xs:simpleType name="osisIDRegex">
<xs:restriction base="xs:string">
<xs:pattern value="(((\p{L}|\p{N}|_)+)((\.(\p{L}|\p{N}|_)+)*)?:)?((\p{L}|\p{N}|_)+)((\.(\p{L}|\p{N}|_|(\\[^\s]))+)*)?(!((\p{L}|\p{N}|_|(\\[^\s]))+)((\.(\p{L}|\p{N}|_|(\\[^\s]))+)*)?)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="osisRefType">
<xs:list itemType="osisRefRegex"/>
</xs:simpleType>
<xs:simpleType name="osisRefRegex">
<xs:restriction base="xs:string">
<xs:pattern value="(((\p{L}|\p{N}|_)+)((\.(\p{L}|\p{N}|_)+)*)?:)?((\p{L}|\p{N}|_)+)(\.(\p{L}|\p{N}|_|(\\[^\s]))*)*(!((\p{L}|\p{N}|_|(\\[^\s]))+)((\.(\p{L}|\p{N}|_|(\\[^\s]))+)*)?)?(@(cp\[(\p{Nd})*\]|s\[(\p{L}|\p{N})+\](\[(\p{N})+\])?))?(\-((((\p{L}|\p{N}|_|(\\[^\s]))+)(\.(\p{L}|\p{N}|_|(\\[^\s]))*)*)+)(!((\p{L}|\p{N}|_|(\\[^\s]))+)((\.(\p{L}|\p{N}|_|(\\[^\s]))+)*)?)?(@(cp\[(\p{Nd})*\]|s\[(\p{L}|\p{N})+\](\[(\p{N})+\])?))?)?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="osisDateType">
<xs:restriction base="xs:string">
<xs:pattern value="(~)?(-)?([0-9]{4})?(:([0-9]{2}))?(:([0-9]{2}))?(T((([0-9]{2})?(:[0-9]{2})?(:[0-9]{2})?)|~([\c]*)))?"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="osisAnnotateRefType">
<xs:union memberTypes="osisRefRegex osisGenRegex"/>
</xs:simpleType>
<xs:simpleType name="annotateRefType">
<xs:list itemType="osisAnnotateRefType"/>
</xs:simpleType>
<xs:simpleType name="attributeExtension">
<xs:restriction base="xs:string">
<xs:pattern value="x-([^\s])+"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="divType">
<xs:union memberTypes="osisDivs attributeExtension"/>
</xs:simpleType>
<xs:simpleType name="osisDivs">
<xs:restriction base="xs:string">
<xs:enumeration value="acknowledgement"/>
<xs:enumeration value="afterword"/>
<xs:enumeration value="appendix"/>
<xs:enumeration value="back"/>
<xs:enumeration value="body"/>
<xs:enumeration value="book"/>
<xs:enumeration value="bookGroup"/>
<xs:enumeration value="colophon"/>
<xs:enumeration value="commentary"/>
<xs:enumeration value="concordance"/>
<xs:enumeration value="coverPage"/>
<xs:enumeration value="dedication"/>
<xs:enumeration value="devotional"/>
<xs:enumeration value="entry"/>
<xs:enumeration value="front"/>
<xs:enumeration value="gazetteer"/>
<xs:enumeration value="glossary"/>
<xs:enumeration value="imprimatur"/>
<xs:enumeration value="index"/>
<xs:enumeration value="introduction"/>
<xs:enumeration value="majorSection"/>
<xs:enumeration value="map"/>
<xs:enumeration value="outline"/>
<xs:enumeration value="preface"/>
<xs:enumeration value="section"/>
<xs:enumeration value="subSection"/>
<xs:enumeration value="titlePage"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
--------------050007040906090007090405--