<?xml version="1.0"?>

<!DOCTYPE erl PUBLIC "-//DSI//DTD ERL V1.1//EN" "erl.dtd">

<erl id="library" title="A Library">

&ERWauth;

<enum id="termlen" type="char" size="1">
	<enumval value="L" label="Long term"/>
	<enumval value="S" label="Short term"/>
</enum>

<ent id="person" label="Person">
	<attr id="fname" label="First Name" size="30" mand="true"/>
	<attr id="lname" label="Last Name" size="30" mand="true"/>
</ent>

<ent id="subscriber" label="Subscriber">
	<isa entref="person"/>
	<attr id="card" label="Card number" type="int" mand="true"/>
	<attr id="address" label="Address" mand="true"/>
	<attr id="donation" label="Donation" type="numeric" size="11" scale="2"/>
</ent>

<ent id="book" label="Book">
	<attr id="title" label="Title" mand="true"/>
	<attr id="author" label="Author" size="40" mand="true"/>
	<attr id="publisher" label="Publisher" mand="true"/>
	<attr id="isbn" label="ISBN Code"/>
	<attr id="year" label="Year" type="integer"/>
	<attr id="description" label="Description" type="text"/>
</ent>

<rel id="loan" label="Loan">
	<attr id="startdate" label="Start date" type="date" mand="true" 
                default="CURRENT_DATE"/>
	<attr id="enddate" label="End date" type="date"/>
	<attr id="duration" label="Type" type="enum" enumref="termlen" mand="true"/>
	<leg entref="person" label="Borrowed..."/>
	<leg entref="book" label="Lent to..."/>
</rel>

</erl>