<commit_before><project name="InterMine model" default="all" basedir=".">
  <description>InterMine model build file</description>

  <!--
  The following properties are used in this file:

  model.name: the name of the model
  model.src: the source location for the model
  class.path: the classpath to use
  db.name: the name of the database to build, if actually building the schema
  build.model: the location of the model build directory
  build.tmp: the location to store temporary files
  resources: the location of any static resource files
  namespace: the namespace to use when processing XML model files
  packagename: the packagename to use for the generated classes
  -->

  <property name="build.model.dir" location="${build.model}/${model.name}"/>
  <property name="build.model.dir.tmp" location="${build.model.dir}/tmp"/>
  <property name="build.model.dir.tmp.builddb" location="${build.model.dir.tmp}/builddb"/>
  <property name="build.model.dir.resources" location="${build.model.dir}/resources"/>
  <property name="model.lib" location="${model.src}/lib"/>

  <path id="compile.class.path">
    <path refid="class.path"/>
    <fileset dir="${model.lib}">
      <include name="*.jar"/>
    </fileset>
  </path>

  <path id="test.class.path">
    <path refid="compile.class.path"/>
    <pathelement location="${build.model.dir.tmp}"/>
    <pathelement location="${build.model.dir.resources}"/>
  </path>

  <!-- Create the directory that this model will be built to -->
  <target name="prepare"
          description="Create a directory that this model will be built to">
    <mkdir dir="${build.model.dir}" />
    <mkdir dir="${build.model.dir.resources}" />
    <mkdir dir="${build.model.dir.tmp}" />
    <mkdir dir="${build.model.dir.tmp.builddb}" />
  </target>


  <!-- has .zargo been unzipped? -->
  <target name="unpack-xmi-model.check" depends="prepare">
    <uptodate property="unpack-xmi-model.uptodate">
      <srcfiles dir="${model.src}" includes="${model.name}.zargo" />
      <mapper type="glob" from="*.zargo" to="${build.model.dir.tmp}/*_.xmi" />
    </uptodate>
  </target>
  
  <!-- unzip .zargo file -->
  <target name="unpack-xmi-model" depends="unpack-xmi-model.check"
          description="unpacks an XMI model from .zargo file"
          unless="unpack-xmi-model.uptodate">
    <unzip src="${model.src}/${model.name}.zargo" dest="${build.model.dir.tmp}">
      <patternset>
        <include name="${model.name}_.xmi"/>
      </patternset>
    </unzip>

    <touch file="${build.model.dir.tmp}/${model.name}_.xmi" />
  </target>


  <!-- copy an exiting xmi file to build/tmp -->
  <target name="copy-xmi" depends="prepare">
    <copy file="${model.src}/${model.name}.xmi" tofile="${build.model.dir.tmp}/${model.name}_.xmi"/>
  </target>


  <!-- copy intermine xml model file to build model directory -->
  <target name="copy-xml-model" depends="prepare">
    <copy todir="${build.model.dir}" file="${model.src}/${model.name}_model.xml"/>
  </target>

  <!-- copy key definition files -->
  <target name="copy-keydefs" depends="prepare">
    <copy todir="${build.model.dir}">
      <fileset dir="${model}/${model.name}/resources">
        <include name="*.properties"/>
      </fileset>
    </copy>
  </target>

  <!-- copy test resources -->
  <target name="copy-test-resources" depends="prepare">
    <copy todir="${build.model.dir.resources}">
      <fileset dir="${model}/${model.name}/resources"/>
    </copy>
  </target>


  <!-- Model generation targets -->
  <target name="generate-xmi-model"
          description="Generate InterMine model from an XMI file">
    <taskdef name="model-generation" classname="org.intermine.modelproduction.ModelGenerationTask">
      <classpath refid="class.path"/>
    </taskdef>

    <!-- if from ArgoUML the XMI filename will have a trailing underscore -->


    <model-generation
       type="xmi"
       nameSpace="${namespace}"
       modelName="${model.name}"
       source="${build.model.dir.tmp}/${model.name}_.xmi"<commit_msg>do not fail if keydefs not found<commit_after><project name="InterMine model" default="all" basedir=".">
  <description>InterMine model build file</description>

  <!--
  The following properties are used in this file:

  model.name: the name of the model
  model.src: the source location for the model
  class.path: the classpath to use
  db.name: the name of the database to build, if actually building the schema
  build.model: the location of the model build directory
  build.tmp: the location to store temporary files
  resources: the location of any static resource files
  namespace: the namespace to use when processing XML model files
  packagename: the packagename to use for the generated classes
  -->

  <property name="build.model.dir" location="${build.model}/${model.name}"/>
  <property name="build.model.dir.tmp" location="${build.model.dir}/tmp"/>
  <property name="build.model.dir.tmp.builddb" location="${build.model.dir.tmp}/builddb"/>
  <property name="build.model.dir.resources" location="${build.model.dir}/resources"/>
  <property name="model.lib" location="${model.src}/lib"/>

  <path id="compile.class.path">
    <path refid="class.path"/>
    <fileset dir="${model.lib}">
      <include name="*.jar"/>
    </fileset>
  </path>

  <path id="test.class.path">
    <path refid="compile.class.path"/>
    <pathelement location="${build.model.dir.tmp}"/>
    <pathelement location="${build.model.dir.resources}"/>
  </path>

  <!-- Create the directory that this model will be built to -->
  <target name="prepare"
          description="Create a directory that this model will be built to">
    <mkdir dir="${build.model.dir}" />
    <mkdir dir="${build.model.dir.resources}" />
    <mkdir dir="${build.model.dir.tmp}" />
    <mkdir dir="${build.model.dir.tmp.builddb}" />
  </target>


  <!-- has .zargo been unzipped? -->
  <target name="unpack-xmi-model.check" depends="prepare">
    <uptodate property="unpack-xmi-model.uptodate">
      <srcfiles dir="${model.src}" includes="${model.name}.zargo" />
      <mapper type="glob" from="*.zargo" to="${build.model.dir.tmp}/*_.xmi" />
    </uptodate>
  </target>
  
  <!-- unzip .zargo file -->
  <target name="unpack-xmi-model" depends="unpack-xmi-model.check"
          description="unpacks an XMI model from .zargo file"
          unless="unpack-xmi-model.uptodate">
    <unzip src="${model.src}/${model.name}.zargo" dest="${build.model.dir.tmp}">
      <patternset>
        <include name="${model.name}_.xmi"/>
      </patternset>
    </unzip>

    <touch file="${build.model.dir.tmp}/${model.name}_.xmi" />
  </target>


  <!-- copy an exiting xmi file to build/tmp -->
  <target name="copy-xmi" depends="prepare">
    <copy file="${model.src}/${model.name}.xmi" tofile="${build.model.dir.tmp}/${model.name}_.xmi"/>
  </target>


  <!-- copy intermine xml model file to build model directory -->
  <target name="copy-xml-model" depends="prepare">
    <copy todir="${build.model.dir}" file="${model.src}/${model.name}_model.xml"/>
  </target>

  <!-- copy key definition files -->
  <target name="copy-keydefs" depends="prepare">
    <copy todir="${build.model.dir}" failonerror="false">
      <fileset dir="${model}/${model.name}/resources">
        <include name="*.properties"/>
      </fileset>
    </copy>
  </target>

  <!-- copy test resources -->
  <target name="copy-test-resources" depends="prepare">
    <copy todir="${build.model.dir.resources}">
      <fileset dir="${model}/${model.name}/resources"/>
    </copy>
  </target>


  <!-- Model generation targets -->
  <target name="generate-xmi-model"
          description="Generate InterMine model from an XMI file">
    <taskdef name="model-generation" classname="org.intermine.modelproduction.ModelGenerationTask">
      <classpath refid="class.path"/>
    </taskdef>

    <!-- if from ArgoUML the XMI filename will have a trailing underscore -->


    <model-generation
       type="xmi"
       nameSpace="${namespace}"
       modelName="${model.name}"
       source="${build.model.dir.tmp}/${model.name}_.xmi"
{'fraction_non_alphanumeric': 0.18126626192541198, 'fraction_numerical': 0.0, 'mean_word_length': 3.459668508287293, 'pattern_counts': {'":': 0, '<': 147, '<?xml version=': 0, '>': 145, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1042404', 'n_tokens_mistral': 2514, 'n_tokens_neox': 2459, 'n_words': 586}