Search in sources :

Example 6 with VCID

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;
}
Also used : VCID(cbit.vcell.biomodel.meta.VCID) NonRDFAnnotation(cbit.vcell.biomodel.meta.NonRDFAnnotation) Element(org.jdom.Element) Text(org.jdom.Text) Identifiable(org.vcell.util.document.Identifiable) Entry(cbit.vcell.biomodel.meta.registry.Registry.Entry) Map(java.util.Map)

Example 7 with VCID

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);
}
Also used : VCID(cbit.vcell.biomodel.meta.VCID) Attribute(org.jdom.Attribute) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 8 with VCID

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;
}
Also used : VCID(cbit.vcell.biomodel.meta.VCID) VCMetaData(cbit.vcell.biomodel.meta.VCMetaData) ArrayList(java.util.ArrayList)

Example 9 with VCID

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;
}
Also used : VCID(cbit.vcell.biomodel.meta.VCID) Resource(org.openrdf.model.Resource)

Example 10 with VCID

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;
}
Also used : VCID(cbit.vcell.biomodel.meta.VCID)

Aggregations

VCID (cbit.vcell.biomodel.meta.VCID)10 Identifiable (org.vcell.util.document.Identifiable)5 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 Element (org.jdom.Element)3 MiriamManager (cbit.vcell.biomodel.meta.MiriamManager)2 MiriamRefGroup (cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)2 MiriamResource (cbit.vcell.biomodel.meta.MiriamManager.MiriamResource)2 Entry (cbit.vcell.biomodel.meta.registry.Registry.Entry)2 TreeMap (java.util.TreeMap)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 Resource (org.openrdf.model.Resource)2 MIRIAMQualifier (org.vcell.sybil.models.miriam.MIRIAMQualifier)2 IdentifiableComparator (cbit.vcell.biomodel.meta.IdentifiableComparator)1 NonRDFAnnotation (cbit.vcell.biomodel.meta.NonRDFAnnotation)1 InvalidVCIDException (cbit.vcell.biomodel.meta.VCID.InvalidVCIDException)1 VCMetaData (cbit.vcell.biomodel.meta.VCMetaData)1 Registry (cbit.vcell.biomodel.meta.registry.Registry)1 Annotation (cbit.vcell.desktop.Annotation)1 BioModelNode (cbit.vcell.desktop.BioModelNode)1