<?xml version="1.0" encoding="UTF-8"?>
<model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.cems.uwe.ac.uk/xmlwiki/ER/model.xsd" name="Cloud Appreciation" quote-names="true">
    <type name="image" datatype="MEDIUMBLOB"/>
    <type name="url" datatype="VARCHAR(50)">
        <comment>a valid URL held as a string -see REGEXLib for examples</comment>
    </type>
    <type name="email" datatype="VARCHAR(50)">
        <comment>valid email address </comment>
    </type>
    
    <entity name="photo">
        <attribute name="imageid" primarykey="true"/>
        <attribute name="image" type="image"/>
        <attribute name="text"/>
        <attribute name="photographer"/>
        <attribute name="datetimeEntered" datatype="date"/>
    </entity>
    <entity name="comment">
        <attribute name="timestamp" primarykey="true"/>
        
        <attribute name="author"/>
        <attribute name="text"/>
        <attribute name="website" min="0" type="url"/>
        <attribute name="email" min="0" type="email"/>
    </entity>
    <entity name="category">
        <attribute name="catid" primarykey="true"/>
        <attribute name="name"/>
    </entity>
    
    <relationship name="comment">
        <role entity="photo"/>
        <role entity="comment" min="0" max="N" dependent="true"/>
    </relationship>
   
    <relationship name="categorised">
        <role entity="photo" max="N"/>
        <role entity="category" max="N" min="1"/>
    </relationship>
    <relationship name="includes">
        <role entity="category" min="0"/>
        <role entity="category" name="subCategory" min="0" max="N"/>
    </relationship>
    <comment> This model is of the photo gallery site <a href="http://cloudappreciationsociety.org">Cloud
        Appreciation Society</a>
    </comment>
</model>
