[osis-core] key/keyref test file

Patrick Durusau osis-core@bibletechnologieswg.org
Sat, 18 May 2002 15:55:58 -0400


This is a multi-part message in MIME format.
--------------000007060807020001060202
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Guys,

Have not forgotten about you!

Attached is a very simply test file and schema for the key/keyref 
mechanism for crossing boundaries. Validates but I need a sanity check 
on it.

Note that if we use keys, that the key value is REQUIRED to be present. 
Keyref is optional since you don't have to link back to another element.

Not a problem for me (note that I said ID but probably should say 
verseID or something like that and validate against the reference type 
(I am working on Steve's reference syntax now and checking the full 
schema for any other problems) but thought we needed to be aware that 
anything we allow to cross boundaries will ALWAYS have to contain the 
key, whether in use or not.

So far as I remember, that includes q, seg, speech, verse, what else?

We are not starting the meeting until 10 AM tomorrow so will have some 
time in the morning to implement the mechanism if this works for everybody.

Patrick

-- 
Patrick Durusau
Director of Research and Development
Society of Biblical Literature
pdurusau@emory.edu


--------------000007060807020001060202
Content-Type: text/xml;
 name="osis_versekey.xsd"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="osis_versekey.xsd"

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

<xs:element name="osisText">
	<xs:complexType>
		<xs:sequence>
			<xs:element ref="front" minOccurs="0" maxOccurs="1"/>
			<xs:element ref="body" minOccurs="1" maxOccurs="1"/>
		</xs:sequence>
	</xs:complexType>
</xs:element>

<xs:element name="front">
	<xs:complexType>
		<xs:sequence>
			<xs:element ref="title" minOccurs="0"/>
			<xs:element ref="div" minOccurs="1" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
</xs:element>

<xs:element name="body">
	<xs:complexType>
		<xs:sequence>
			<xs:element ref="title" minOccurs="0"/>
			<xs:element ref="div" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
</xs:element>

<xs:element name="div">
	    <xs:complexType mixed="true">
		<xs:choice minOccurs="0" maxOccurs="unbounded">
			   <xs:element ref="p"/>
			   <xs:element ref="verse"/>
		</xs:choice>
	    </xs:complexType>
</xs:element>

<xs:element name="p">
	    <xs:complexType mixed="true">
	    	<xs:choice minOccurs="0" maxOccurs="unbounded">
			   <xs:element ref="verse"/>
			   <xs:element ref="w"/>
		</xs:choice>
	   </xs:complexType>
</xs:element>

<xs:element name="q" type="xs:string"/>

<xs:element name="title" type="xs:string"/>

<xs:element name="verse">
	    <xs:complexType mixed="true">
	    	<xs:choice minOccurs="0" maxOccurs="unbounded">
			   <xs:element ref="q"/>
			   <xs:element ref="w"/>
		</xs:choice>
		<xs:attribute name="ID" type="xs:string"/>
		<xs:attribute name="prev" type="xs:string" use="optional"/>
	   </xs:complexType>
	   <xs:key name="prevKey">
		   <xs:selector xpath=".//verse"/>
		   <xs:field xpath="@ID"/>
	   </xs:key>
	   <xs:keyref name="prevRef" refer="prevKey">
		   <xs:selector xpath=".//verse"/>
		   <xs:field xpath="@prev"/>
	   </xs:keyref>
</xs:element>

<xs:element name="w" type="xs:string"/>

</xs:schema>
--------------000007060807020001060202
Content-Type: text/xml;
 name="osis-sample.xml"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="osis-sample.xml"

<?xml version="1.0" encoding="UTF-8"?>
<osisText xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="osis_versekey.xsd">
	<front>
		<title>OSIS test document</title>
		<div>Just some text.</div>
	</front>
	<body>
		<title>Testing key/keyref here on verses</title>
		<div><p>This is a sample file to test the key and keyref mechanism of XML Schema. The next div will have two imaginary verses, the second of which crosses the boundary of the div into the third div of this document.</p></div>
  <div><verse>I wonder if this will work in real time since the first reference, i.e., the next attribute is non-nillable i order to do key/keyref in XML schema?</verse><verse ID="Patrick.1.2">Hard to say but if this test document works it can go out to the group for comments, and then...</verse></div>
  <div><verse prev="Patrick.1.2">we will see what everyone has to say about it.</verse></div>
	</body>
</osisText>

--------------000007060807020001060202--