|
From: <rv...@us...> - 2009-07-02 21:02:24
|
Revision: 162
http://treebase.svn.sourceforge.net/treebase/?rev=162&view=rev
Author: rvos
Date: 2009-07-02 21:02:07 +0000 (Thu, 02 Jul 2009)
Log Message:
-----------
Added treebase term annotations
Modified Paths:
--------------
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/NexmlMatrixConverter.java
trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlOTUConverter.java
trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlObjectConverter.java
trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlTreeBlockConverter.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 2009-07-02 10:48:31 UTC (rev 161)
+++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentConverter.java 2009-07-02 21:02:07 UTC (rev 162)
@@ -95,8 +95,9 @@
* @param document
*/
private void copyCitationMetadata(Citation citation,Document document) {
+ attachAnnotation("dcterms.bibliographicCitation",citation.getAuthorsCitationStyleWithoutHtml(),mDCURI,document);
if ( null != citation.getTitle() ) {
- attachAnnotation("dc:title",citation.getTitle(),mPrismURI,document);
+ attachAnnotation("tb:title.study",citation.getTitle(),mTBTermsURI,document);
}
if ( null != citation.getPublishYear() ) {
attachAnnotation("prism:publicationDate",citation.getPublishYear().toString(),mPrismURI,document);
@@ -115,7 +116,7 @@
if ( null != citation.getKeywords() ) {
String[] keywords = citation.getKeywords().split(", ");
for ( int i = 0; i < keywords.length; i++ ) {
- attachAnnotation("prism:keyword",keywords[i],mPrismURI,document);
+ attachAnnotation("dcterms:subject",keywords[i],mDCURI,document);
}
}
if ( citation instanceof ArticleCitation ) {
@@ -162,12 +163,14 @@
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("dc:title", pStudy.getName(), mDCURI, getDocument());
+ attachAnnotation("tb:title.study", pStudy.getName(), mTBTermsURI, getDocument());
}
for ( Person person : pStudy.getAuthors() ) {
String personName = person.getFullNameCitationStyle();
- attachAnnotation("dc:contributor",personName,mDCURI,getDocument());
+ attachAnnotation("dcterms:contributor",personName,mDCURI,getDocument());
}
if ( null != pStudy.getReleaseDate() ) {
attachAnnotation("prism:embargoDate",pStudy.getReleaseDate().toString(),mPrismURI,getDocument());
@@ -175,7 +178,7 @@
if ( null != pStudy.getSubmission() ) {
if ( null != pStudy.getSubmission().getSubmitter() ) {
attachAnnotation(
- "dc:creator",
+ "dcterms:creator",
pStudy.getSubmission().getSubmitter().getPerson().getFullNameCitationStyle(),
mDCURI,
getDocument()
Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java
===================================================================
--- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java 2009-07-02 10:48:31 UTC (rev 161)
+++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java 2009-07-02 21:02:07 UTC (rev 162)
@@ -178,7 +178,7 @@
xmlState.setLabel(tbState.getDescription());
}
if ( null != tbState.getNotes() ) {
- ((Annotatable)xmlState).addAnnotationValue("dc:description", mDCURI, tbState.getNotes());
+ ((Annotatable)xmlState).addAnnotationValue("dcterms:description", mDCURI, tbState.getNotes());
}
attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class);
}
@@ -220,7 +220,7 @@
org.nexml.model.Character xmlCharacter = xmlMatrix.createCharacter(xmlStateSet);
PhyloChar tbCharacter = tbColumn.getCharacter();
if ( null != tbCharacter.getDescription() && ! tbCharacter.getDescription().equals(tbDataType) ) {
- ((Annotatable)xmlCharacter).addAnnotationValue("dc:description", mDCURI, tbCharacter.getDescription());
+ ((Annotatable)xmlCharacter).addAnnotationValue("dcterms:description", mDCURI, tbCharacter.getDescription());
}
if ( null != tbCharacter.getId() && tbCharacter.getId() != 2 ) { // XXX is PhyloChar.id 2 some sort of magic number?
attachTreeBaseID((Annotatable)xmlCharacter,tbCharacter,PhyloChar.class);
@@ -243,7 +243,7 @@
org.nexml.model.Character xmlCharacter = xmlMatrix.createCharacter();
PhyloChar tbCharacter = tbColumn.getCharacter();
if ( null != tbCharacter.getDescription() ) {
- ((Annotatable)xmlCharacter).addAnnotationValue("dc:description", mDCURI, tbCharacter.getDescription());
+ ((Annotatable)xmlCharacter).addAnnotationValue("dcterms:description", mDCURI, tbCharacter.getDescription());
}
attachTreeBaseID((Annotatable)xmlCharacter,tbCharacter,PhyloChar.class);
}
@@ -273,6 +273,10 @@
}
xmlMatrix.setLabel(tbMatrix.getTitle());
attachTreeBaseID((Annotatable)xmlMatrix, tbMatrix,Matrix.class);
+ ((Annotatable)xmlMatrix).addAnnotationValue("tb:type.matrix", mTBTermsURI, tbMatrix.getDataType().getDescription());
+ ((Annotatable)xmlMatrix).addAnnotationValue("tb:ntax.matrix", mTBTermsURI, tbMatrix.getnTax());
+ ((Annotatable)xmlMatrix).addAnnotationValue("tb:nchar.matrix", mTBTermsURI, tbMatrix.getnChar());
+ ((Annotatable)xmlMatrix).addAnnotationValue("tb:identifier.matrix", mTBTermsURI, tbMatrix.getId());
return xmlMatrix;
}
Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlOTUConverter.java
===================================================================
--- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlOTUConverter.java 2009-07-02 10:48:31 UTC (rev 161)
+++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlOTUConverter.java 2009-07-02 21:02:07 UTC (rev 162)
@@ -85,6 +85,10 @@
StringBuilder urlString = new StringBuilder(getDocument().getBaseURI().toString());
taxonLabel.getPhyloWSPath().getPath(urlString).append("NCBI:").append(taxonLabel.getNcbiTaxID());
xmlOTU.addAnnotationValue("dc:relation", mDCURI, URI.create(urlString.toString()));
+ xmlOTU.addAnnotationValue("tb:identifier.ncbi", mTBTermsURI, "NCBI:" + taxonLabel.getNcbiTaxID());
+ xmlOTU.addAnnotationValue("tb:identifier.taxon", mTBTermsURI, taxonLabel.getTaxonVariant().getTaxon().getId());
+ xmlOTU.addAnnotationValue("tb:identifier.taxonLabel", mTBTermsURI, taxonLabel.getId());
+ xmlOTU.addAnnotationValue("tb:title.taxon", mTBTermsURI, taxonLabel.getTaxonVariant().getTaxon().getName());
}
TaxonVariant tv = taxonLabel.getTaxonVariant();
if ( null != tv ) {
@@ -92,6 +96,9 @@
StringBuilder urlString = new StringBuilder(getDocument().getBaseURI().toString());
taxonLabel.getPhyloWSPath().getPath(urlString).append("uBio:").append(tv.getNamebankID());
xmlOTU.addAnnotationValue("dc:relation", mDCURI, URI.create(urlString.toString()));
+ xmlOTU.addAnnotationValue("tb:identifier.ubio", mTBTermsURI, "uBio:" + tv.getNamebankID());
+ xmlOTU.addAnnotationValue("tb:identifier.taxonVariant", mTBTermsURI, tv.getId());
+ xmlOTU.addAnnotationValue("tb:title.taxonVariant", mTBTermsURI, tv.getFullName());
}
}
return xmlOTU;
Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlObjectConverter.java
===================================================================
--- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlObjectConverter.java 2009-07-02 10:48:31 UTC (rev 161)
+++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlObjectConverter.java 2009-07-02 21:02:07 UTC (rev 162)
@@ -23,11 +23,13 @@
public class NexmlObjectConverter extends AbstractNexusConverter {
protected static URI mDCURI;
protected static URI mPrismURI;
+ protected static URI mTBTermsURI;
protected URI mBaseURI;
- private static String mDCURIString = "http://purl.org/dc/elements/1.1/";
+ private static String mTBTermsString = "http://treebase.org/terms#";
+ private static String mDCURIString = "http://purl.org/dc/terms/";
private static String mPrismURIString = "http://prismstandard.org/namespaces/1.2/basic/";
private static String mBaseURIString = "http://purl.org/PHYLO/TREEBASE/PHYLOWS/";
- private static String mDCIdentifier = "dc:identifier";
+ private static String mDCIdentifier = "dcterms:identifier";
public static String TreeBASE2Prefix = "TreeBASE2";
private Document mDocument;
@@ -40,6 +42,7 @@
try {
mDCURI = new URI(mDCURIString);
mPrismURI = new URI(mPrismURIString);
+ mTBTermsURI = new URI(mTBTermsString);
if ( null != baseURI ) {
mBaseURI = new URI(baseURI);
}
@@ -81,7 +84,7 @@
if ( null != tbPersistable.getId() ) {
//attachAnnotation(mDCIdentifier,makeNamespacedID(tbPersistable,persistableClass),mDCURI,annotatable);
String uriString = getDocument().getBaseURI().toString() + tbPersistable.getPhyloWSPath().toString();
- annotatable.addAnnotationValue("dc:relation",mDCURI, URI.create(uriString));
+ annotatable.addAnnotationValue("dcterms:relation",mDCURI, URI.create(uriString));
}
}
@@ -108,7 +111,7 @@
// dc:identifier predicate in a nexml meta annotation,
// e.g. <meta property="dc:identifier" content="TB2:Tr231"/>
// this will return something that stringifies to TB2:Tr231
- Set<Object> dublinCoreRelationObjects = annotatable.getRelValues("dc:relation");
+ Set<Object> dublinCoreRelationObjects = annotatable.getRelValues("dcterms:relation");
Iterator<Object> objectIterator = dublinCoreRelationObjects.iterator();
while ( objectIterator.hasNext() ) {
URI relationURI = (URI)objectIterator.next();
Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlTreeBlockConverter.java
===================================================================
--- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlTreeBlockConverter.java 2009-07-02 10:48:31 UTC (rev 161)
+++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlTreeBlockConverter.java 2009-07-02 21:02:07 UTC (rev 162)
@@ -84,6 +84,11 @@
if ( null != phyloTree.getLabel() ) {
xmlTree.setLabel(phyloTree.getLabel());
}
+ xmlTree.addAnnotationValue("tb:identifier.tree", mTBTermsURI, phyloTree.getId());
+ xmlTree.addAnnotationValue("tb:kind.tree", mTBTermsURI, phyloTree.getKindDescription());
+ xmlTree.addAnnotationValue("tb:type.tree", mTBTermsURI, phyloTree.getTypeDescription());
+ xmlTree.addAnnotationValue("tb:quality.tree", mTBTermsURI, phyloTree.getQualityDescription());
+ xmlTree.addAnnotationValue("tb:ntax.tree", mTBTermsURI, phyloTree.getnTax());
attachTreeBaseID(xmlTree, phyloTree,PhyloTree.class);
copyTreeBaseTree(phyloTree, xmlTree);
return xmlTree;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|