|
From: <rv...@us...> - 2010-03-15 01:04:45
|
Revision: 571
http://treebase.svn.sourceforge.net/treebase/?rev=571&view=rev
Author: rvos
Date: 2010-03-15 01:04:39 +0000 (Mon, 15 Mar 2010)
Log Message:
-----------
Now calls getAnnotations() to let the object decide what metadata to add as opposed to fiddling with the object here.
Modified Paths:
--------------
trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentConverter.java
Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentConverter.java
===================================================================
--- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentConverter.java 2010-03-15 01:02:39 UTC (rev 570)
+++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentConverter.java 2010-03-15 01:04:39 UTC (rev 571)
@@ -1,10 +1,11 @@
package org.cipres.treebase.domain.nexus.nexml;
-import org.cipres.treebase.domain.admin.Person;
+//import org.cipres.treebase.Constants;
+//import org.cipres.treebase.domain.admin.Person;
import org.cipres.treebase.domain.matrix.CharacterMatrix;
import org.cipres.treebase.domain.nexus.NexusDataSet;
-import org.cipres.treebase.domain.study.ArticleCitation;
-import org.cipres.treebase.domain.study.Citation;
+//import org.cipres.treebase.domain.study.ArticleCitation;
+//import org.cipres.treebase.domain.study.Citation;
import org.cipres.treebase.domain.study.Study;
import org.cipres.treebase.domain.taxon.TaxonLabelHome;
import org.cipres.treebase.domain.taxon.TaxonLabelSet;
@@ -91,55 +92,11 @@
/**
*
- * @param citation
- * @param document
- */
- private void copyCitationMetadata(Citation citation,Document document) {
- attachAnnotation("dcterms:bibliographicCitation",citation.getAuthorsCitationStyleWithoutHtml(),mDCURI,document);
- if ( null != citation.getTitle() ) {
- attachAnnotation("tb:title.study",citation.getTitle(),mTBTermsURI,document);
- }
- if ( null != citation.getPublishYear() ) {
- attachAnnotation("prism:publicationDate",citation.getPublishYear().toString(),mPrismURI,document);
- }
- if ( null != citation.getDoi() ) {
- attachAnnotation("prism:doi",citation.getDoi(),mPrismURI,document);
- }
- if ( null != citation.getPages() ) {
- String[] pages = citation.getPages().split("\\-");
- if ( pages.length == 2 ) {
- attachAnnotation("prism:startingPage",pages[0],mPrismURI,document);
- attachAnnotation("prism:endingPage",pages[1],mPrismURI,document);
- attachAnnotation("prism:pageRange",citation.getPages(),mPrismURI,document);
- }
- }
- if ( null != citation.getKeywords() ) {
- String[] keywords = citation.getKeywords().split(", ");
- for ( int i = 0; i < keywords.length; i++ ) {
- attachAnnotation("dcterms:subject",keywords[i],mDCURI,document);
- }
- }
- if ( citation instanceof ArticleCitation ) {
- ArticleCitation ac = (ArticleCitation)citation;
- if ( null != ac.getJournal() ) {
- attachAnnotation("prism:publicationName",ac.getJournal(),mPrismURI,document);
- }
- if ( null != ac.getVolume() ) {
- attachAnnotation("prism:volume",ac.getVolume(),mPrismURI,document);
- }
- if ( null != ac.getIssue() ) {
- attachAnnotation("prism:number",ac.getIssue(),mPrismURI,document);
- }
- }
- }
-
- /**
- *
* @param pStudy
* @return
*/
public Document fromTreeBaseToXml(Study pStudy) {
- copyMetadata(pStudy);
+ attachTreeBaseID(getDocument(), pStudy,Study.class);
NexmlOTUConverter noc = new NexmlOTUConverter(getStudy(),getTaxonLabelHome(),getDocument());
for ( TaxonLabelSet taxonLabelSet : pStudy.getTaxonLabelSets() ) {
@@ -161,37 +118,4 @@
return getDocument();
}
- private void copyMetadata(Study pStudy) {
- attachTreeBaseID(getDocument(), pStudy,Study.class);
- attachAnnotation("tb:identifier.study",pStudy.getId().toString(), mTBTermsURI, getDocument());
- attachAnnotation("tb:identifier.study.tb1",pStudy.getTB1StudyID(), mTBTermsURI, getDocument());
- if ( null != pStudy.getName() ) {
- attachAnnotation("tb:title.study", pStudy.getName(), mTBTermsURI, getDocument());
- }
- for ( Person person : pStudy.getAuthors() ) {
- String personName = person.getFullNameCitationStyle();
- attachAnnotation("dcterms:contributor",personName,mDCURI,getDocument());
- }
- if ( null != pStudy.getReleaseDate() ) {
- attachAnnotation("prism:embargoDate",pStudy.getReleaseDate().toString(),mPrismURI,getDocument());
- }
- if ( null != pStudy.getSubmission() ) {
- if ( null != pStudy.getSubmission().getSubmitter() ) {
- attachAnnotation(
- "dcterms:creator",
- pStudy.getSubmission().getSubmitter().getPerson().getFullNameCitationStyle(),
- mDCURI,
- getDocument()
- );
- }
- if ( null != pStudy.getSubmission().getCreateDate() ) {
- attachAnnotation("prism:creationDate",pStudy.getSubmission().getCreateDate().toString(),mPrismURI,getDocument());
- }
- }
- if ( null != pStudy.getCitation() ) {
- //attachAnnotation("dc:abstract",forXML(pStudy.getCitation().getAbstract()), mDCURI,getDocument());
- copyCitationMetadata(pStudy.getCitation(),getDocument());
- }
- }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|