<?xml version="1.0" encoding="UTF-8"?>
<!--
  ****************************************************************
ERmodel_v1.2/instances/catalogue/src/conceptualModels/2RegularHypergraph.xml 
****************************************************************

Copyright 2016, 2107 Cyprotex Discovery Ltd.

This file is part of the the ERmodel suite of models and transforms.

The ERmodel suite is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

ERmodel suite is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
****************************************************************
-->
<entity_model xmlns="http://www.entitymodelling.org/ERmodel">
   <presentation>
      <diagram>
         <deltah>0.1</deltah>
         <deltaw>2.0</deltaw>
      </diagram>
   </presentation>
   <description>
      A second example designed to test code generation. This example includes pullbacks.
   </description>
   <absolute>
      <name>codeTest</name>
      <composition>
         <type>A(1)</type>
         <cardinality>
            <OneOrMore/>
         </cardinality>
      </composition>
      <composition>
         <name>a</name>
         <type>A(2)</type>
         <cardinality>
            <OneOrMore/>
         </cardinality>
      </composition>
   </absolute>
   <group>
      <name>lhs</name>
      <presentation>
         <x>4.0</x>
         <y>1.3</y>
      </presentation>
      <module_name>lhs</module_name>
      <entity_type>
         <name>A(1)</name>
         <presentation>
            <deltaw>0.3</deltaw>
            <y>0.5</y>
         </presentation>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>name</name>
            <type>
               <string/>
            </type>
            <identifying/>
         </attribute>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>bool</name>
            <type>
               <boolean/>
            </type>
         </attribute>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>timestamp</name>
            <type>
               <dateTime/>
            </type>
         </attribute>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>text</name>
            <type>
               <string/>
            </type>
         </attribute>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>real</name>
            <type>
               <float/>
            </type>
            <optional/>
         </attribute>
         <choice>
            <name>colour</name>
            <from>colour</from>
            <optional/>
         </choice>
         <composition>
            <name>x</name>
            <type>X(1)</type>
            <cardinality>
               <OneOrMore/>
            </cardinality>
            <identifying/>
            <inverse>..</inverse>
         </composition>
         <reference>
            <name>f</name>
            <type>A(2)</type>
            <cardinality>
               <ExactlyOne/>
            </cardinality>
            <diagonal>
               <theabsolute/>
            </diagonal>
            <riser>
               <theabsolute/>
            </riser>
            <diagram>
               <path>
                  <align>
                     <ToDest/>
                  </align>
                  <label>
                     <position>
                        <Upside/>
                     </position>
                  </label>
                  <inverse>
                     <label>
                        <position>
                           <Downside/>
                        </position>
                     </label>
                  </inverse>
                  <scope>
                     <label>
                        <xAdjustment>-0.5</xAdjustment>
                     </label>
                  </scope>
               </path>
            </diagram>
         </reference>
      </entity_type>
      <entity_type>
         <name>X(1)</name>
         <presentation>
            <below>A(1)</below>
            <y>2.0</y>
            <deltaw>0.6</deltaw>
         </presentation>
         <dependency>
            <name>..</name>
            <type>A(1)</type>
            <cardinality>
               <ExactlyOne/>
            </cardinality>
            <inverse_of>x</inverse_of>
         </dependency>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>text</name>
            <type>
               <string/>
            </type>
         </attribute>
         <reference>
            <name>basedOn</name>
            <type>X(1)</type>
            <cardinality>
               <ExactlyOne/>
            </cardinality>
            <diagonal>
               <component>
                  <rel>..</rel>
               </component>
            </diagonal>
            <riser>
               <component>
                  <rel>..</rel>
               </component>
            </riser>
            <diagram>
               <path>
                  <srcsign>-1</srcsign>
                  <srcarmlen>1.0</srcarmlen>
                  <srcattach>0.7</srcattach>
                  <destsign>-1.0</destsign>
                  <destarmlen>1.0</destarmlen>
                  <destattach>0.3</destattach>
               </path>
            </diagram>
         </reference>
         <composition>
            <name>b1</name>
            <type>B1</type>
            <cardinality>
               <OneOrMore/>
            </cardinality>
            <identifying/>
            <inverse>p1</inverse>
            <pullback>
               <type>B2</type>
               <along>
                  <component>
                     <rel>subject</rel>
                  </component>
               </along>
               <riser2>
                  <component>
                     <rel>..</rel>
                  </component>
               </riser2>
               <projection_rel>g</projection_rel>
            </pullback>
         </composition>
         <reference>
            <name>subject</name>
            <type>X(2)</type>
            <cardinality>
               <ExactlyOne/>
            </cardinality>
            <identifying/>
            <diagonal>
               <join>
                  <component>
                     <rel>..</rel>
                  </component>
                  <component>
                     <rel>f</rel>
                  </component>
               </join>
            </diagonal>
            <riser>
               <component>
                  <rel>p2</rel>
               </component>
            </riser>
            <diagram>
               <path>
                  <align>
                     <ToDest/>
                  </align>
                  <label>
                     <position>
                        <Upside/>
                     </position>
                  </label>
                  <inverse>
                     <label>
                        <position>
                           <Downside/>
                        </position>
                     </label>
                  </inverse>
                  <scope>
                     <label>
                        <xAdjustment>-0.75</xAdjustment>
                     </label>
                  </scope>
               </path>
            </diagram>
         </reference>
      </entity_type>
      <entity_type>
         <name>B1</name>
         <presentation>
            <below>X(1)</below>
            <y>2.5</y>
            <deltaw>0.3</deltaw>
         </presentation>
         <dependency>
            <name>p1</name>
            <type>X(1)</type>
            <cardinality>
               <ExactlyOne/>
            </cardinality>
            <inverse_of>b1</inverse_of>
         </dependency>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>text</name>
            <type>
               <string/>
            </type>
         </attribute>
         <composition>
            <type>P</type>
            <inverse>..</inverse>
            <cardinality>
               <ZeroOrOne/>
            </cardinality>
            <pullback>
               <type>P</type>
               <projection_rel>pBasedOn</projection_rel>
               <along>
                  <component>
                     <rel>basedOn</rel>
                  </component>
               </along>
               <riser2>
                  <component>
                     <rel>..</rel>
                  </component>
               </riser2>
            </pullback>
         </composition>
         <reference>
            <name>basedOn</name>
            <type>B1</type>
            <cardinality>
               <ExactlyOne/>
            </cardinality>
            <diagonal>
               <join>
                  <component>
                     <rel>p1</rel>
                  </component>
                  <component>
                     <rel>basedOn</rel>
                  </component>
               </join>
            </diagonal>
            <riser>
               <component>
                  <rel>p1</rel>
               </component>
            </riser>
            <key>
               <component>
                  <rel>g</rel>
               </component>
            </key>
            <diagram>
               <path>
                  <srcsign>-1</srcsign>
                  <srcarmlen>1.0</srcarmlen>
                  <srcattach>0.7</srcattach>
                  <destsign>-1.0</destsign>
                  <destarmlen>1.0</destarmlen>
                  <destattach>0.3</destattach>
                  <scope>
                     <label>
                        <yAdjustment>-0.25</yAdjustment>
                     </label>
                  </scope>
               </path>
            </diagram>
         </reference>
         <reference>
            <name>g</name>
            <type>B2</type>
            <cardinality>
               <ExactlyOne/>
            </cardinality>
            <identifying/>
            <projection/>
            <diagonal>
               <join>
                  <component>
                     <rel>p1</rel>
                  </component>
                  <component>
                     <rel>subject</rel>
                  </component>
               </join>
            </diagonal>
            <riser>
               <join>
                  <component>
                     <rel>..</rel>
                  </component>
               </join>
            </riser>
            <diagram>
               <path>
                  <align>
                     <ToDest/>
                  </align>
                  <label>
                     <position>
                        <Upside/>
                     </position>
                  </label>
                  <inverse>
                     <label>
                        <position>
                           <Downside/>
                        </position>
                     </label>
                  </inverse>
                  <scope>
                     <label>
                        <xAdjustment>-1.0</xAdjustment>
                     </label>
                  </scope>
               </path>
            </diagram>
         </reference>
      </entity_type>
      <entity_type>
         <name>P</name>
         <presentation>
            <below>B1</below>
            <y>0.5</y>
         </presentation>
         <dependency>
            <type>B1</type>
            <name>..</name>
         </dependency>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>text</name>
            <type>
               <string/>
            </type>
         </attribute>
         <reference>
            <name>pBasedOn</name>
            <type>P</type>
            <cardinality>
               <ZeroOrOne/>
            </cardinality>
            <projection/>
            <diagram>
               <path>
                  <srcsign>-1</srcsign>
                  <srcarmlen>1.0</srcarmlen>
                  <srcattach>0.7</srcattach>
                  <destsign>-1.0</destsign>
                  <destarmlen>1.0</destarmlen>
                  <destattach>0.3</destattach>
                  <scope>
                     <label>
                        <yAdjustment>-0.3</yAdjustment>
                     </label>
                  </scope>
               </path>
            </diagram>
            <diagonal>
               <join>
                  <component>
                     <rel>..</rel>
                  </component>
                  <component>
                     <rel>basedOn</rel>
                  </component>
               </join>
            </diagonal>
            <riser>
               <component>
                  <rel>..</rel>
               </component>
            </riser>
         </reference>
      </entity_type>
   </group>
   <group>
      <name>rhs</name>
      <presentation>
         <rightOf>lhs</rightOf>
         <x>4.0</x>
      </presentation>
      <module_name>rhs</module_name>
      <entity_type>
         <name>A(2)</name>
         <presentation>
            <y>1.0</y>
         </presentation>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>name</name>
            <type>
               <string/>
            </type>
            <identifying/>
         </attribute>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>number</name>
            <type>
               <integer/>
            </type>
            <identifying/>
         </attribute>
         <composition>
            <name>x</name>
            <type>X(2)</type>
            <cardinality>
               <OneOrMore/>
            </cardinality>
            <identifying/>
            <inverse>p2</inverse>
         </composition>
      </entity_type>
      <entity_type>
         <name>X(2)</name>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>Xname1</name>
            <type>
               <string/>
            </type>
            <identifying/>
         </attribute>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>Xname2</name>
            <type>
               <string/>
            </type>
            <identifying/>
         </attribute>
         <presentation>
            <below>A(2)</below>
            <rightOf>X(1)</rightOf>
            <deltaw>0.3</deltaw>
         </presentation>
         <dependency>
            <name>p2</name>
            <type>A(2)</type>
            <cardinality>
               <ExactlyOne/>
            </cardinality>
            <inverse_of>x</inverse_of>
         </dependency>
         <composition>
            <name>b2</name>
            <type>B2</type>
            <cardinality>
               <OneOrMore/>
            </cardinality>
            <identifying/>
            <inverse>..</inverse>
         </composition>
      </entity_type>
      <entity_type>
         <name>B2</name>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>B2name1</name>
            <type>
               <string/>
            </type>
            <identifying/>
         </attribute>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>B2name2</name>
            <type>
               <string/>
            </type>
            <identifying/>
         </attribute>
         <presentation>
            <rightOf>B1</rightOf>
            <below>X(2)</below>
            <deltaw>0.3</deltaw>
         </presentation>
         <dependency>
            <name>..</name>
            <type>X(2)</type>
            <cardinality>
               <ExactlyOne/>
            </cardinality>
            <inverse_of>b2</inverse_of>
         </dependency>
         <composition>
            <name>y</name>
            <type>Y</type>
            <cardinality>
               <ZeroOneOrMore/>
            </cardinality>
            <inverse>..</inverse>
         </composition>
      </entity_type>
      <entity_type>
         <name>Y</name>
         <attribute xmlns:era="http://www.entitymodelling.org/ERmodel">
            <name>name</name>
            <type>
               <string/>
            </type>
            <identifying/>
         </attribute>
         <presentation>
            <below>B2</below>
            <deltaw>0.3</deltaw>
         </presentation>
         <dependency>
            <name>..</name>
            <type>B2</type>
            <cardinality>
               <ExactlyOne/>
            </cardinality>
            <inverse_of>y</inverse_of>
         </dependency>
      </entity_type>
   </group>
   <enumeration_type>
      <name>colour</name>
      <enumeration_value>
         <literal>Red</literal>
      </enumeration_value>
      <enumeration_value>
         <literal>Blue</literal>
      </enumeration_value>
      <enumeration_value>
         <literal>Yellow</literal>
      </enumeration_value>
   </enumeration_type>
</entity_model>
