From: <rv...@us...> - 2012-02-05 15:23:16
|
Revision: 1055 http://treebase.svn.sourceforge.net/treebase/?rev=1055&view=rev Author: rvos Date: 2012-02-05 15:23:09 +0000 (Sun, 05 Feb 2012) Log Message: ----------- Now uses org.nexml.model.MatrixRow objects to attach Darwin Core annotations Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-04 09:26:30 UTC (rev 1054) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-05 15:23:09 UTC (rev 1055) @@ -30,6 +30,7 @@ import org.cipres.treebase.domain.taxon.SpecimenLabel; import org.cipres.treebase.domain.taxon.TaxonLabelHome; import org.nexml.model.Annotatable; +import org.nexml.model.Annotation; import org.nexml.model.CategoricalMatrix; import org.nexml.model.CharacterState; import org.nexml.model.CharacterStateSet; @@ -340,6 +341,8 @@ } else { String seq = tbRow.getNormalizedSymbolString(); + + // In NeXML, 'standard' data needs to be space-separated if ( tbMatrix.getDataType().getDescription().equals(MatrixDataType.MATRIX_DATATYPE_STANDARD) ) { StringBuilder sb = new StringBuilder(); for ( int i = 0; i < seq.length(); i++ ) { @@ -348,19 +351,23 @@ sb.append(' '); } } - } + } xmlMatrix.setSeq(seq,xmlOTU); // this often only happens once, when the row has only 1 segment for ( RowSegment tbSegment : tbSegments ) { - copyDarwinCoreAnnotations(tbSegment, xmlOTU); + org.nexml.model.MatrixRow<CharacterState> xmlRow = xmlMatrix.getRowObject(xmlOTU); + Annotation xmlSegment = xmlRow.addAnnotationValue("tb:rowSegment", Constants.TBTermsURI, new String()); + xmlSegment.addAnnotationValue("tb:startIndex", Constants.TBTermsURI, tbSegment.getStartIndex()); + xmlSegment.addAnnotationValue("tb:endIndex", Constants.TBTermsURI, tbSegment.getEndIndex()); + copyDarwinCoreAnnotations(tbSegment, xmlSegment); } } } } /** - * + * XXX this never executes, we always make compact matrices - RAV 5/2/2012 * @param xmlMatrix * @param tbMatrix * @param xmlCharacterList @@ -421,7 +428,11 @@ } Set<RowSegment> tbSegments = tbRow.getSegmentsReadOnly(); for ( RowSegment tbSegment : tbSegments ) { - copyDarwinCoreAnnotations(tbSegment,xmlOTU); + org.nexml.model.MatrixRow<Double> xmlRow = xmlMatrix.getRowObject(xmlOTU); + Annotation xmlSegment = xmlRow.addAnnotationValue("tb:rowSegment", Constants.TBTermsURI, new String()); + xmlSegment.addAnnotationValue("tb:startIndex", Constants.TBTermsURI, tbSegment.getStartIndex()); + xmlSegment.addAnnotationValue("tb:endIndex", Constants.TBTermsURI, tbSegment.getEndIndex()); + copyDarwinCoreAnnotations(tbSegment,xmlSegment); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |