use of cbit.vcell.biomodel.meta.VCID 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;
}
use of cbit.vcell.biomodel.meta.VCID in project vcell by virtualcell.
the class RelationshipReader method addObjectRelationshipObject.
private RelationshipObject addObjectRelationshipObject(Element element, IdentifiableProvider provider) throws Exception {
VCID bioPaxObjectID = null;
VCID bioModelObjectID = null;
for (Object attr : element.getAttributes()) {
Attribute attribute = (Attribute) attr;
if (attribute.getName().equals(XMLTags.bioPaxObjectIdTag)) {
bioPaxObjectID = VCID.fromString(attribute.getValue());
} else if (attribute.getName().equals(XMLTags.bioModelObjectIdTag)) {
bioModelObjectID = VCID.fromString(attribute.getValue());
}
}
return RelationshipObject.createRelationshipObject(bioModelObjectID, bioPaxObjectID, provider);
}
use of cbit.vcell.biomodel.meta.VCID in project vcell by virtualcell.
the class AnnotationMapping method getComponentInfo.
private ArrayList<String> getComponentInfo(BioModel bioModel, Identifiable identifiable) {
ArrayList<String> info = new ArrayList<String>();
VCMetaData vcMetaData = bioModel.getVCMetaData();
VCID vcid = vcMetaData.getIdentifiableProvider().getVCID(identifiable);
String modelComponentType = vcid.getClassName();
String modelComponentName = vcid.getLocalName();
info.add(modelComponentName);
info.add(modelComponentType);
return info;
}
use of cbit.vcell.biomodel.meta.VCID in project vcell by virtualcell.
the class Registry method compareEquals.
public boolean compareEquals(Registry other) {
Set<Resource> resSet = resourceToEntry.keySet();
Set<Resource> otherResSet = other.resourceToEntry.keySet();
if (!resSet.equals(otherResSet)) {
return false;
}
for (Resource res : resSet) {
Entry oe = resourceToEntry.get(res);
Entry otherOe = other.resourceToEntry.get(res);
final VCID vcid = identifiableProvider.getVCID(oe.getIdentifiable());
final VCID otherVcid = other.identifiableProvider.getVCID(otherOe.getIdentifiable());
if (!vcid.toASCIIString().equals(otherVcid.toASCIIString())) {
return false;
}
}
return true;
}
use of cbit.vcell.biomodel.meta.VCID in project vcell by virtualcell.
the class RelationshipObject method compare.
public final boolean compare(HashSet<RelationshipObject> theirRelationshipObjects, IdentifiableProvider provider) {
for (RelationshipObject theirRelationshipObject : theirRelationshipObjects) {
VCID vcidBpOurs = provider.getVCID(getBioPaxObject());
VCID vcidBpTheirs = provider.getVCID(theirRelationshipObject.getBioPaxObject());
VCID vcidBmOurs = provider.getVCID(getBioModelEntityObject());
VCID vcidBmTheirs = provider.getVCID(theirRelationshipObject.getBioModelEntityObject());
if (vcidBpOurs.equals(vcidBpTheirs) && vcidBmOurs.equals(vcidBmTheirs)) {
return true;
}
}
return false;
}
Aggregations