Search in sources :

Example 1 with Provenance

use of org.vcell.pathway.Provenance in project vcell by virtualcell.

the class PathwayReaderBiopax3 method addObjectProvenance.

private Provenance addObjectProvenance(Element element) {
    if (element.getChildren().size() == 0) {
        // if there are no children it must be a resource inside another object
        ProvenanceProxy proxy = new ProvenanceProxy();
        addAttributes(proxy, element);
        pathwayModel.add(proxy);
        return proxy;
    }
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (childElement.getName().equals("Provenance")) {
                Provenance thingie = addObjectProvenance(childElement);
                pathwayModel.add(thingie);
                return thingie;
            }
        }
    }
    Provenance provenance = new Provenance();
    addAttributes(provenance, element);
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (!addContentProvenance(provenance, element, childElement)) {
                showUnexpected(childElement);
            }
        }
    }
    pathwayModel.add(provenance);
    return provenance;
}
Also used : Provenance(org.vcell.pathway.Provenance) ProvenanceProxy(org.vcell.pathway.persistence.BiopaxProxy.ProvenanceProxy) Element(org.jdom.Element) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject)

Example 2 with Provenance

use of org.vcell.pathway.Provenance in project vcell by virtualcell.

the class PathwayProducerBiopax3 method addContentEntity.

// dataSource		Provenance	multiple
// availability	String		multiple
// name			String		multiple
// xref			Xref		multiple
// evidence		Evidence	multiple
private Element addContentEntity(BioPaxObject bpObject, Element element) {
    element = addContentBioPaxObject(bpObject, element);
    Entity ob = (Entity) bpObject;
    Element tmpElement = null;
    if (ob.getDataSource() != null && ob.getDataSource().size() > 0) {
        ArrayList<Provenance> list = ob.getDataSource();
        for (Provenance item : list) {
            tmpElement = new Element("dataSource", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getAvailability() != null && ob.getAvailability().size() > 0) {
        ArrayList<String> list = ob.getAvailability();
        for (String item : list) {
            tmpElement = new Element("availability", bp);
            tmpElement.setAttribute("datatype", schemaString, rdf);
            tmpElement.setText(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getName() != null && ob.getName().size() > 0) {
        ArrayList<String> list = ob.getName();
        for (String item : list) {
            tmpElement = new Element("name", bp);
            tmpElement.setAttribute("datatype", schemaString, rdf);
            tmpElement.setText(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getxRef() != null && ob.getxRef().size() > 0) {
        ArrayList<Xref> list = ob.getxRef();
        for (Xref item : list) {
            String elementName = "xref";
            tmpElement = new Element(elementName, bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getEvidence() != null && ob.getEvidence().size() > 0) {
        ArrayList<Evidence> list = ob.getEvidence();
        for (Evidence item : list) {
            tmpElement = new Element("evidence", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getSBSubEntity() != null && ob.getSBSubEntity().size() > 0) {
        ArrayList<SBEntity> list = ob.getSBSubEntity();
        for (SBEntity item : list) {
            tmpElement = new Element("sbSubEntity", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    return element;
}
Also used : SBEntity(org.vcell.pathway.sbpax.SBEntity) PhysicalEntity(org.vcell.pathway.PhysicalEntity) Entity(org.vcell.pathway.Entity) Provenance(org.vcell.pathway.Provenance) Xref(org.vcell.pathway.Xref) RelationshipXref(org.vcell.pathway.RelationshipXref) PublicationXref(org.vcell.pathway.PublicationXref) Element(org.jdom.Element) Evidence(org.vcell.pathway.Evidence) PathwayXMLHelper.schemaString(org.vcell.pathway.PathwayXMLHelper.schemaString) SBEntity(org.vcell.pathway.sbpax.SBEntity)

Example 3 with Provenance

use of org.vcell.pathway.Provenance in project vcell by virtualcell.

the class PathwayReader method addObjectProvenance.

private Provenance addObjectProvenance(Element element) {
    Provenance provenance = new Provenance();
    addAttributes(provenance, element);
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (!addContentProvenance(provenance, element, childElement)) {
                showUnexpected(childElement, provenance);
            }
        }
    }
    pathwayModel.add(provenance);
    return provenance;
}
Also used : Provenance(org.vcell.pathway.Provenance) Element(org.jdom.Element) BioPaxObject(org.vcell.pathway.BioPaxObject)

Example 4 with Provenance

use of org.vcell.pathway.Provenance in project vcell by virtualcell.

the class PathwayProducerBiopax3 method addContentProvenance.

// name 	String 	multiple
// xref 	Xref 	multiple
private Element addContentProvenance(BioPaxObject bpObject, Element element) {
    element = addContentUtilityClass(bpObject, element);
    Provenance ob = (Provenance) bpObject;
    Element tmpElement = null;
    if (ob.getName() != null && ob.getName().size() > 0) {
        List<String> list = ob.getName();
        for (String item : list) {
            tmpElement = new Element("name", bp);
            tmpElement.setAttribute("datatype", schemaString, rdf);
            tmpElement.setText(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getxRef() != null && ob.getxRef().size() > 0) {
        List<Xref> list = ob.getxRef();
        for (Xref item : list) {
            tmpElement = new Element("xref", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    return element;
}
Also used : Provenance(org.vcell.pathway.Provenance) Xref(org.vcell.pathway.Xref) RelationshipXref(org.vcell.pathway.RelationshipXref) PublicationXref(org.vcell.pathway.PublicationXref) Element(org.jdom.Element) PathwayXMLHelper.schemaString(org.vcell.pathway.PathwayXMLHelper.schemaString)

Aggregations

Element (org.jdom.Element)4 Provenance (org.vcell.pathway.Provenance)4 BioPaxObject (org.vcell.pathway.BioPaxObject)2 PathwayXMLHelper.schemaString (org.vcell.pathway.PathwayXMLHelper.schemaString)2 PublicationXref (org.vcell.pathway.PublicationXref)2 RelationshipXref (org.vcell.pathway.RelationshipXref)2 Xref (org.vcell.pathway.Xref)2 Entity (org.vcell.pathway.Entity)1 Evidence (org.vcell.pathway.Evidence)1 GroupObject (org.vcell.pathway.GroupObject)1 PhysicalEntity (org.vcell.pathway.PhysicalEntity)1 ProvenanceProxy (org.vcell.pathway.persistence.BiopaxProxy.ProvenanceProxy)1 SBEntity (org.vcell.pathway.sbpax.SBEntity)1