From: <rv...@us...> - 2010-03-15 01:14:09
|
Revision: 578 http://treebase.svn.sourceforge.net/treebase/?rev=578&view=rev Author: rvos Date: 2010-03-15 01:14:03 +0000 (Mon, 15 Mar 2010) Log Message: ----------- Added getAnnotations() and getLabel() for nexml and rdf serialization. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2010-03-15 01:13:21 UTC (rev 577) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2010-03-15 01:14:03 UTC (rev 578) @@ -1,5 +1,9 @@ package org.cipres.treebase.domain.taxon; +import java.net.URI; +import java.util.List; +import java.util.Set; + import javax.persistence.AttributeOverride; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -10,8 +14,12 @@ import javax.persistence.Table; import javax.persistence.Transient; +import org.cipres.treebase.Constants; +import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.domain.AbstractPersistedObject; +import org.cipres.treebase.domain.Annotation; import org.cipres.treebase.domain.TBPersistable; +import org.cipres.treebase.domain.admin.Person; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.study.Submission; import org.hibernate.annotations.BatchSize; @@ -194,4 +202,35 @@ } return result; } + + @Transient + public List<Annotation> getAnnotations() { + List<Annotation> annotations = super.getAnnotations(); + if ( null != getNcbiTaxID() ) { + StringBuilder urlString = new StringBuilder(TreebaseUtil.getPurlDomain()); + getPhyloWSPath().getPath(urlString).append("NCBI:").append(getNcbiTaxID()); + annotations.add(new Annotation(Constants.DCTermsURI, "dc:relation", URI.create(urlString.toString()))); + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.ncbi", "NCBI:" + getNcbiTaxID())); + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxon", getTaxonVariant().getTaxon().getId())); + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxonLabel", getId())); + annotations.add(new Annotation(Constants.TBTermsURI, "tb:title.taxon", getTaxonVariant().getTaxon().getName())); + } + TaxonVariant tv = getTaxonVariant(); + if ( null != tv ) { + if ( null != tv.getNamebankID() ) { + StringBuilder urlString = new StringBuilder(TreebaseUtil.getPurlDomain()); + getPhyloWSPath().getPath(urlString).append("uBio:").append(tv.getNamebankID()); + annotations.add(new Annotation(Constants.DCTermsURI, "dc:relation", URI.create(urlString.toString()))); + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.ubio", "uBio:" + tv.getNamebankID())); + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxonVariant", tv.getId())); + annotations.add(new Annotation(Constants.TBTermsURI, "tb:title.taxonVariant", tv.getFullName())); + } + } + return annotations; + } + + @Transient + public String getLabel() { + return getTaxonLabel(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2010-03-16 16:49:25
|
Revision: 600 http://treebase.svn.sourceforge.net/treebase/?rev=600&view=rev Author: rvos Date: 2010-03-16 16:49:19 +0000 (Tue, 16 Mar 2010) Log Message: ----------- Cleaned up annotations, wrapped inside try {} block to be safe. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2010-03-16 16:48:22 UTC (rev 599) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2010-03-16 16:49:19 UTC (rev 600) @@ -25,6 +25,8 @@ import org.hibernate.annotations.BatchSize; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; import org.hibernate.annotations.Index; /** @@ -134,6 +136,7 @@ */ @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.MERGE, CascadeType.PERSIST}) @JoinColumn(name = "TAXONVARIANT_ID", nullable = true) + @Fetch(FetchMode.JOIN) public TaxonVariant getTaxonVariant() { return mTaxonVariant; } @@ -153,6 +156,7 @@ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "STUDY_ID", nullable = true) @Index(name = "TLABEL_STUDY_IDX") + @Fetch(FetchMode.JOIN) public Study getStudy() { return mStudy; } @@ -206,26 +210,29 @@ @Transient public List<Annotation> getAnnotations() { List<Annotation> annotations = super.getAnnotations(); - if ( null != getNcbiTaxID() ) { - StringBuilder urlString = new StringBuilder(TreebaseUtil.getPurlDomain()); - getPhyloWSPath().getPath(urlString).append("NCBI:").append(getNcbiTaxID()); - annotations.add(new Annotation(Constants.DCTermsURI, "dc:relation", URI.create(urlString.toString()))); - annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.ncbi", "NCBI:" + getNcbiTaxID())); - annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxon", getTaxonVariant().getTaxon().getId())); - annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxonLabel", getId())); - annotations.add(new Annotation(Constants.TBTermsURI, "tb:title.taxon", getTaxonVariant().getTaxon().getName())); + try { + TaxonVariant tv = getTaxonVariant(); + if ( null != tv ) { + if ( null != tv.getNamebankID() ) { + annotations.add(new Annotation(Constants.SKOSURI, "skos:closeMatch", URI.create(Constants.uBioBase+tv.getNamebankID()))); + String fullName = tv.getFullName(); + if ( ! getLabel().equals(fullName) ) { + annotations.add(new Annotation(Constants.SKOSURI, "skos:altLabel",fullName)); + } + if ( null != getNcbiTaxID() ) { + annotations.add(new Annotation(Constants.SKOSURI, "skos:closeMatch", URI.create(String.format(Constants.NCBITaxonomyFormat, getNcbiTaxID())))); + String taxonName = tv.getTaxon().getLabel(); + if ( ! fullName.equals(taxonName) ) { + annotations.add(new Annotation(Constants.SKOSURI, "skos:prefLabel",taxonName)); + } + + } + } + } } - TaxonVariant tv = getTaxonVariant(); - if ( null != tv ) { - if ( null != tv.getNamebankID() ) { - StringBuilder urlString = new StringBuilder(TreebaseUtil.getPurlDomain()); - getPhyloWSPath().getPath(urlString).append("uBio:").append(tv.getNamebankID()); - annotations.add(new Annotation(Constants.DCTermsURI, "dc:relation", URI.create(urlString.toString()))); - annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.ubio", "uBio:" + tv.getNamebankID())); - annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxonVariant", tv.getId())); - annotations.add(new Annotation(Constants.TBTermsURI, "tb:title.taxonVariant", tv.getFullName())); - } - } + catch ( Exception e) { + e.printStackTrace(); + } return annotations; } @@ -233,4 +240,9 @@ public String getLabel() { return getTaxonLabel(); } + + @Transient + public Study getContext() { + return getStudy(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yo...@us...> - 2010-04-08 19:37:15
|
Revision: 680 http://treebase.svn.sourceforge.net/treebase/?rev=680&view=rev Author: youjun Date: 2010-04-08 19:37:09 +0000 (Thu, 08 Apr 2010) Log Message: ----------- avoid using sub_taxonlabel table Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2010-04-07 20:33:07 UTC (rev 679) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2010-04-08 19:37:09 UTC (rev 680) @@ -58,7 +58,7 @@ private TaxonVariant mTaxonVariant; private Study mStudy; - private Submission mSubmission; + //private Submission mSubmission; private Set<TaxonLabelSet> mTaxonLabelSet; /** * Constructor. @@ -174,29 +174,34 @@ } /** - * Return the submission this taxonLabel inhabits - * - * @return the submission - * @author mjd 20080929 - * modified by Youjun - */ - @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) - @JoinTable(name = "sub_taxonlabel", - joinColumns = @JoinColumn(name = "taxonlabel_id"), - inverseJoinColumns = @JoinColumn(name="submission_id") + * Return the submission this taxonLabel inhabits + * + * @return the submission + * @author mjd 20080929 + */ + @Transient + public Submission getSubmission() { + Study s = getStudy(); + return s == null ? null : s.getSubmission(); + } + + //@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + //@JoinTable(name = "sub_taxonlabel", + // joinColumns = @JoinColumn(name = "taxonlabel_id"), + // inverseJoinColumns = @JoinColumn(name="submission_id") - ) - public Submission getSubmission() { + //) + //public Submission getSubmission() { - return mSubmission; - } + // return mSubmission; + //} /** * Set the Submission field. */ - public void setSubmission(Submission pNewSubmission) { - mSubmission = pNewSubmission; - } + //public void setSubmission(Submission pNewSubmission) { + // mSubmission = pNewSubmission; + //} /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2010-06-04 11:27:38
|
Revision: 715 http://treebase.svn.sourceforge.net/treebase/?rev=715&view=rev Author: rvos Date: 2010-06-04 11:27:31 +0000 (Fri, 04 Jun 2010) Log Message: ----------- Adding annotations of tb:identifier.taxon.tb1 and tb:identifier.taxonVariants.tb1, if applicable Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2010-06-04 11:26:33 UTC (rev 714) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2010-06-04 11:27:31 UTC (rev 715) @@ -265,13 +265,19 @@ } if ( null != getNcbiTaxID() ) { annotations.add(new Annotation(Constants.SKOSURI, "skos:closeMatch", URI.create(String.format(Constants.NCBITaxonomyFormat, getNcbiTaxID())))); - String taxonName = tv.getTaxon().getLabel(); + Taxon taxon = tv.getTaxon(); + String taxonName = taxon.getLabel(); if ( ! fullName.equals(taxonName) ) { annotations.add(new Annotation(Constants.SKOSURI, "skos:prefLabel",taxonName)); } - + if ( null != taxon.getTB1LegacyId() ) { + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxon.tb1", taxon.getTB1LegacyId())); + } } } + if ( null != tv.getTB1LegacyId() ) { + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxonVariant.tb1", tv.getTB1LegacyId())); + } } } catch ( Exception e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2011-03-24 11:28:05
|
Revision: 778 http://treebase.svn.sourceforge.net/treebase/?rev=778&view=rev Author: rvos Date: 2011-03-24 11:27:59 +0000 (Thu, 24 Mar 2011) Log Message: ----------- Added annotations to TaxonLabel to include TaxonVariant and Taxon ID in results. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2011-03-22 17:45:05 UTC (rev 777) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2011-03-24 11:27:59 UTC (rev 778) @@ -277,7 +277,12 @@ } if ( null != tv.getTB1LegacyId() ) { annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxonVariant.tb1", tv.getTB1LegacyId())); - } + } + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxonVariant", tv.getId())); + Taxon taxon = tv.getTaxon(); + if ( null != taxon ) { + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxon", taxon.getId())); + } } } catch ( Exception e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2011-04-19 11:16:09
|
Revision: 789 http://treebase.svn.sourceforge.net/treebase/?rev=789&view=rev Author: rvos Date: 2011-04-19 11:16:03 +0000 (Tue, 19 Apr 2011) Log Message: ----------- Now checking to make sure the "legacy" id and the current one aren't the same thing. Only attaching them if they aren't. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2011-04-19 11:10:53 UTC (rev 788) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2011-04-19 11:16:03 UTC (rev 789) @@ -270,13 +270,15 @@ if ( ! fullName.equals(taxonName) ) { annotations.add(new Annotation(Constants.SKOSURI, "skos:prefLabel",taxonName)); } - if ( null != taxon.getTB1LegacyId() ) { - annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxon.tb1", taxon.getTB1LegacyId())); + Integer tb1LegacyID = taxon.getTB1LegacyId(); + if ( null != tb1LegacyID && taxon.getId() != tb1LegacyID.longValue() ) { + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxon.tb1", tb1LegacyID.longValue())); } } } - if ( null != tv.getTB1LegacyId() ) { - annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxonVariant.tb1", tv.getTB1LegacyId())); + Integer tb1TvId = tv.getTB1LegacyId(); + if ( null != tb1TvId && tv.getId() != tb1TvId.longValue() ) { + annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxonVariant.tb1", tb1TvId.longValue() )); } annotations.add(new Annotation(Constants.TBTermsURI, "tb:identifier.taxonVariant", tv.getId())); Taxon taxon = tv.getTaxon(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-01 21:03:30
|
Revision: 1030 http://treebase.svn.sourceforge.net/treebase/?rev=1030&view=rev Author: rvos Date: 2012-02-01 21:03:24 +0000 (Wed, 01 Feb 2012) Log Message: ----------- Removed unused imports, trivial commit. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2012-02-01 21:00:31 UTC (rev 1029) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/taxon/TaxonLabel.java 2012-02-01 21:03:24 UTC (rev 1030) @@ -1,7 +1,6 @@ package org.cipres.treebase.domain.taxon; import java.net.URI; -import java.util.Collections; import java.util.List; import java.util.Set; @@ -18,11 +17,9 @@ import javax.persistence.Transient; import org.cipres.treebase.Constants; -import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.domain.AbstractPersistedObject; import org.cipres.treebase.domain.Annotation; import org.cipres.treebase.domain.TBPersistable; -import org.cipres.treebase.domain.admin.Person; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.study.Submission; import org.hibernate.annotations.BatchSize; @@ -31,7 +28,6 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.hibernate.annotations.Index; -import org.hibernate.annotations.IndexColumn; /** * TaxonLabel usually associates with one Taxon. If it does not, it usually means the referred This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |