<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
  xmlns:lib="http://my.library/rdf/syntax#"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	targetNamespace='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
	elementFormDefault="qualified"
>

<xsd:import namespace="http://my.library/rdf/syntax#"
	schemaLocation="library5.xsd"/>

<xsd:attribute name="about"/>
<xsd:attribute name="resource"/>

<xsd:element name="RDF">
	<xsd:complexType content="elementOnly">
	<xsd:sequence>
		<xsd:element ref="lib:book" minOccurs="1" maxOccurs="unbounded"/>
		<xsd:element ref="lib:author" minOccurs="0" maxOccurs="unbounded"/>
		<xsd:element ref="lib:character" minOccurs="0" maxOccurs="unbounded"/>
	</xsd:sequence>
	</xsd:complexType>
	
	<xsd:key name="bookKey">
		<xsd:selector xpath="book"/>
		<xsd:field xpath="@rdf:about"/>
	</xsd:key>

	<xsd:key name="authorKey">
		<xsd:selector xpath="author"/>
		<xsd:field xpath="@rdf:about"/>
	</xsd:key>

	<xsd:key name="characterKey">
		<xsd:selector xpath="character"/>
		<xsd:field xpath="@rdf:about"/>
	</xsd:key>

	<xsd:keyref refer="authorKey" name="book2author">
		<xsd:selector xpath="book/author"/>
		<xsd:field xpath="@rdf:resource"/>
	</xsd:keyref>

	<xsd:keyref refer="characterKey" name="book2character">
		<xsd:selector xpath="book/character"/>
		<xsd:field xpath="@rdf:resource"/>
	</xsd:keyref>

</xsd:element>


</xsd:schema>
