use of cbit.vcell.biomodel.meta.NonRDFAnnotation in project vcell by virtualcell.
the class XMLMetaDataWriter method createNonRDFAnnotationElement.
/**
* creating XMLMetaData element for nonRDFAnnotation element here since nonRDFAnnotation was made package level
* this is similar to XMLRDFWriter.createElement(metaData)
*
* @return the created NonRDFAnnotationListElement
*/
private static Element createNonRDFAnnotationElement(VCMetaData metaData, IdentifiableProvider identifiableProvider) {
Set<Map.Entry<Entry, NonRDFAnnotation>> allNonRdfAnnotations = metaData.getAllNonRDFAnnotations();
Element nonRDFAnnotationListElement = new Element(XMLMetaData.NONRDF_ANNOTATION_LIST_TAG);
Iterator<Map.Entry<Entry, NonRDFAnnotation>> iter = allNonRdfAnnotations.iterator();
while (iter.hasNext()) {
Map.Entry<Entry, NonRDFAnnotation> mapEntry = iter.next();
Entry openEntry = mapEntry.getKey();
NonRDFAnnotation nonRDFAnnotation = mapEntry.getValue();
VCID vcid = identifiableProvider.getVCID(openEntry.getIdentifiable());
Identifiable identifiable = identifiableProvider.getIdentifiableObject(vcid);
// only write out nonRDF annotation if identifiable in identifiableProvider is not null
if (identifiable != null) {
if (!nonRDFAnnotation.isEmpty()) {
Element nonRDFAnnotationElement = new Element(XMLMetaData.NONRDF_ANNOTATION_TAG);
nonRDFAnnotationElement.setAttribute(XMLMetaData.VCID_ATTR_TAG, vcid.toASCIIString());
nonRDFAnnotationListElement.addContent(nonRDFAnnotationElement);
String freeTextAnnotation = nonRDFAnnotation.getFreeTextAnnotation();
if (freeTextAnnotation != null && freeTextAnnotation.length() > 0) {
Element freeTextAnnotationElement = new Element(XMLMetaData.FREETEXT_TAG);
freeTextAnnotationElement.addContent(new Text(freeTextAnnotation));
nonRDFAnnotationElement.addContent(freeTextAnnotationElement);
}
Element xhtmlNotes = nonRDFAnnotation.getXhtmlNotes();
if (xhtmlNotes != null) {
// Element notesElement = new Element(XMLMetaData.NOTES_TAG);
// notesElement.addContent(xhtmlNotes));
nonRDFAnnotationElement.addContent(xhtmlNotes.detach());
}
Element[] otherAnnotations = nonRDFAnnotation.getXmlAnnotations();
if (otherAnnotations != null && otherAnnotations.length > 0) {
Element annotationListElement = new Element(XMLMetaData.ANNOTATION_LIST_TAG);
nonRDFAnnotationElement.addContent(annotationListElement);
for (int i = 0; i < otherAnnotations.length; i++) {
annotationListElement.addContent(otherAnnotations[i].detach());
}
}
}
}
}
return nonRDFAnnotationListElement;
}
Aggregations