Regular expressions for CURIEs

Hello all,

I had an action item to find my work from ages ago on CURIEs, and the
following is what I tracked down. Note that a few lines are commented
out, and I cannot remember why. :(

You'll see that some of this stuff relates to RDFa, but I thought I'd
leave it in, in case it's useful. (Quicker than deleting.)

Regards,

Mark


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 elementFormDefault="qualified"
 xmlns:xfd="http://www.w3.org/2002/xforms#datatypes"
>
	<xs:annotation>
		<xs:documentation>
			RDFa
		</xs:documentation>
	</xs:annotation>
	
	<xs:simpleType name="Curie">
		<xs:restriction base="xs:string">
			<!-- xs:pattern
value="\[[\i-[:]][\c-[:]]*:(([^:/\?#]+):)?(//([^/\?#]*))?([^\?#]*)(\?([^#]*))?(#(.*))?\]"
/ -->
			<xs:pattern value="[\i-[:]][\c-[:]]*:.+" />
		</xs:restriction>
	</xs:simpleType>
	
	<xs:simpleType name="CurieList">
		<xs:list itemType="Curie" />
	</xs:simpleType>
	
	<xs:simpleType name="CurieEsc">
		<xs:restriction base="xs:string">
			<xs:pattern value="\[[\i-[:]][\c-[:]]*:.+\]" />
		</xs:restriction>
	</xs:simpleType>
	
	<xs:simpleType name="CurieOrURI">
		<xs:union memberTypes="xs:anyURI CurieEsc" />
	</xs:simpleType>
	
	<xs:simpleType name="CurieOrLinkType">
		<xs:union memberTypes="Curie">
			<xs:simpleType>
				<xs:restriction base="xs:string">
					<xs:enumeration value="alternate"/>
					<xs:enumeration value="forward"/>
					<xs:enumeration value="start"/>
					<xs:enumeration value="next" />
					<xs:enumeration value="prev" />
					<xs:enumeration value="up" />
					<xs:enumeration value="contents" />
					<xs:enumeration value="index" />
					<xs:enumeration value="glossary" />
					<xs:enumeration value="copyright" />
					<xs:enumeration value="chapter" />
					<xs:enumeration value="section" />
					<xs:enumeration value="subsection" />
					<xs:enumeration value="appendix" />
					<xs:enumeration value="help" />
					<xs:enumeration value="bookmark" />
					<xs:enumeration value="meta" />
					<xs:enumeration value="icon" />
					<xs:enumeration value="p3pv1" />
					<xs:enumeration value="profile" />
					<xs:enumeration value="role" />
					<xs:enumeration value="cite" />
				</xs:restriction>
			</xs:simpleType>
		</xs:union>
	</xs:simpleType>
	
	<xs:simpleType name="CurieOrLinkTypeList">
		<xs:list itemType="CurieOrLinkType" />
	</xs:simpleType>

	<xs:attributeGroup name="rdfa.attlist">
		<xs:attribute name="about" type="CurieOrURI"/>
		<xs:attribute name="content" type="xs:string" />
		<xs:attribute name="datatype" type="Curie"/>
		<xs:attribute name="property" type="Curie"/>
		<xs:attribute name="href" type="CurieOrURI"/>
		<xs:attribute name="rel" type="CurieOrLinkTypeList"/>
		<xs:attribute name="rev" type="CurieOrLinkTypeList"/>
	</xs:attributeGroup>

	<xs:complexType name="rdfa.meta.type" mixed="true">
		<xs:group ref="rdfa.content" minOccurs="0" maxOccurs="unbounded" />
	</xs:complexType>

	<xs:complexType name="rdfa.link.type" mixed="true">
		<xs:group ref="rdfa.content" minOccurs="0" maxOccurs="unbounded" />
	</xs:complexType>

	<xs:group name="rdfa.content">
		<xs:choice>
			<xs:element name="link" type="rdfa.link.type"/>
			<xs:element name="meta" type="rdfa.meta.type"/>
		</xs:choice>
	</xs:group>
</xs:schema>

Regards,

Mark

-- 
  Mark Birbeck

  mark.birbeck@x-port.net | +44 (0) 20 7689 9232
  http://www.x-port.net | http://internet-apps.blogspot.com

  x-port.net Ltd. is registered in England and Wales, number 03730711
  The registered office is at:

    2nd Floor
    Titchfield House
    69-85 Tabernacle Street
    London
    EC2A 4RR

Received on Wednesday, 19 March 2008 14:05:41 UTC