Menu

problem loading records with yyyy-mm-dd dates

Help
dt99
2007-01-15
2013-04-25
  • dt99

    dt99 - 2007-01-15

    Hi

    I written a java script to load records to a uniprot schema generated by xsd2db. Most records load correctly however i have found that some give a java exception

    java.lang.ClassCastException: java.util.GregorianCalendar
            at org.hibernate.type.StringType.toString(StringType.java:42)
            at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:59)
            at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:39).........

    I have narrowed it down to the fact that this record has a yyyy-mm-dd date for one of the citation references. Records with yyyy or yyyy-mm load with no problem. I have also listed below the contents of CitationType.hbm.xml which is just a copy of what was in the uniprotdb.jar from gmbuilder.

    I have been unable to work out what the problem is, can you help?

    Thanks

    Dave

    Problem record
    <?xml version='1.0' encoding='UTF-8'?>
    <uniprot  xmlns="http://uniprot.org/uniprot"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://uniprot.org/uniprot http://www.uniprot.org/support/docs/uniprot.xsd">
    <entry  dataset="Swiss-Prot"  created="2004-05-24"  modified="2006-10-31"  version="12">
      <accession>P61408</accession>
      <name>AF1_GRASP</name>
      <protein>
        <name>Peptide GsAF 1</name>
        <name>GsAF I</name>
      </protein>
      <organism  key="1">
        <name  type="scientific">Grammostola spatulata</name>
        <name  type="common">Chilean rose tarantula</name>
        <dbReference  type="NCBI Taxonomy"  id="29015"  key="2"></dbReference>
        <lineage>
          <taxon>Eukaryota</taxon>
          <taxon>Metazoa</taxon>
          <taxon>Arthropoda</taxon>
          <taxon>Chelicerata</taxon>
          <taxon>Arachnida</taxon>
          <taxon>Araneae</taxon>
          <taxon>Mygalomorphae</taxon>
          <taxon>Theraphosidae</taxon>
          <taxon>Grammostola</taxon>
        </lineage>
      </organism>
      <reference  key="3">
        <citation  type="patent"  date="1999-03-01"  number="US5877026">
          <title>Analgesic peptides from venom of Grammostola spatulata and use thereof.</title>
          <authorList>
            <person  name="Lampe R.A."></person>
          </authorList>
        </citation>
        <scope>PROTEIN SEQUENCE, FUNCTION, AND MASS SPECTROMETRY.</scope>
        <source>
          <tissue>Venom</tissue>
        </source>
      </reference>
      <comment  type="function">
        <text>Induces analgesia in mammals. This analgesia is mediated by a non-opioid receptor related mechanism</text>
      </comment>
      <comment  type="subcellular location">
        <text>Secreted protein</text>
      </comment>
      <comment  type="tissue specificity">
        <text>Expressed by the venom gland</text>
      </comment>
      <comment  type="mass spectrometry"  mass="3713.5"  method="Electrospray">
        <location>
          <begin  position="1"></begin>
          <end  position="29"></end>
        </location>
        <note>Ref.1</note>
      </comment>
      <comment  type="similarity">
        <text>Belongs to the spider potassium channel inhibitory toxin family</text>
      </comment>
      <keyword  id="KW-0027">Amidation</keyword>
      <keyword  id="KW-0903">Direct protein sequencing</keyword>
      <keyword  id="KW-0800">Toxin</keyword>
      <feature  type="peptide"  description="Peptide GsAF 1"  id="PRO_0000044551">
        <location>
          <begin  position="1"></begin>
          <end  position="29"></end>
        </location>
      </feature>
      <feature  type="modified residue"  description="Leucine amide">
        <location>
          <position  position="29"></position>
        </location>
      </feature>
      <feature  type="disulfide bond"  status="by similarity">
        <location>
          <begin  position="2"></begin>
          <end  position="16"></end>
        </location>
      </feature>
      <feature  type="disulfide bond"  status="by similarity">
        <location>
          <begin  position="9"></begin>
          <end  position="21"></end>
        </location>
      </feature>
      <feature  type="disulfide bond"  status="by similarity">
        <location>
          <begin  position="15"></begin>
          <end  position="25"></end>
        </location>
      </feature>
      <sequence  length="29"  mass="3714"  checksum="9CF2F630431B9B37"  modified="2004-05-24"  version="1">
    YCQKWLWTCDSERKCCEDMVCRLWCKKRL
    </sequence>
    </entry>
    </uniprot>

    "CitationType.hbm.xml"
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping auto-import="false" default-cascade="all-delete-orphan" default-lazy="false">
    <class name="org.uniprot.uniprot.CitationType" table="CitationType">
    <id name="Hjid" type="org.hibernate.type.LongType">
    <generator class="native"/>
    </id>
    <discriminator type="org.hibernate.type.StringType">
    <column name="Hjtype"/>
    </discriminator>
    <version name="Hjversion" type="org.hibernate.type.LongType"/>
    <property name="Db">
    <column name="Db"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="First">
    <column name="First"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="Type">
    <column name="Type"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="Institute">
    <column name="Institute"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="Publisher">
    <column name="Publisher"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <list access="org.jvnet.hyperjaxb2.runtime.hibernate.accessor.ListAccessor" name="DbReference" table="CitationType_DbReference">
    <key>
    <column name="CitationType_DbReference_Hjid"/>
    </key>
    <list-index>
    <column name="CitationType_DbReference_Hjindex"/>
    </list-index>
    <one-to-many class="org.uniprot.uniprot.DbReferenceType"/>
    </list>
    <property name="Locator">
    <column name="Locator"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="Date">
    <column name="Date_Hjclass"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="City">
    <column name="City"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="Last">
    <column name="Last"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <many-to-one class="org.uniprot.uniprot.NameListType" name="AuthorList">
    <column name="AuthorList"/>
    </many-to-one>
    <property name="Number">
    <column name="Number"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="Country">
    <column name="Country"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="Volume">
    <column name="Volume"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="Title">
    <column name="Title"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <property name="Name">
    <column name="Name"/>
    <type name="org.hibernate.type.StringType"/>
    </property>
    <many-to-one class="org.uniprot.uniprot.NameListType" name="EditorList">
    <column name="EditorList"/>
    </many-to-one>
    <many-to-one class="org.uniprot.uniprot.CitationType" name="CitingCitation">
    <column name="CitingCitation"/>
    </many-to-one>
    <subclass discriminator-value="org.uniprot.uniprot.CitationType" name="org.uniprot.uniprot.impl.CitationTypeImpl"/>
    </class>
    </hibernate-mapping>

     
    • dondi

      dondi - 2007-01-15

      Yes, I agree with Joe here: if you're loading UniProt from libraries created directly via xsd2db, naming and type issues that are beyond our control crop up.  You can either manually run our post-processor on the xsd2db files (under our uniportdb project, also stored on this site), or just use the uniprotdb.jar that we've already built.  If you download GenMAPP Builder, you'll see uniprotdb.jar (with post-processing already done) in the lib/ directory of the distribution.

       
    • dt99

      dt99 - 2007-01-16

      Hi

      I modified the "date" attribute of the citationtype node in the uniprot xsd from

      <xs:attribute name="date" use="optional">
      <xs:simpleType>
        <xs:union memberTypes="xs:date xs:gYearMonth xs:gYear" />
        </xs:simpleType>
        </xs:attribute>

      to

      <xs:attribute name="date" type="xs:string" use="optional" />

      When I regenerated the libraries the load worked, so far at least. It hasn't errored after 30% of the swissprot file has been loaded :)

      I know that this is referred to in the manual but as a novice it wasn't too clear to me what I should do to fix it.

      Thanks

      Dave

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.