Search in sources :

Example 11 with PathwayModel

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

the class PathwayIOUtil method extractPathwayFromJDOM.

public static PathwayModel extractPathwayFromJDOM(Document jdomDocument, RDFXMLContext context, ClientTaskStatusSupport statusSupport) {
    PathwayModel pathwayModel = null;
    Element rootElement = jdomDocument.getRootElement();
    @SuppressWarnings("unchecked") List<Namespace> namespaces = rootElement.getAdditionalNamespaces();
    boolean itIsLevel3 = false;
    for (Namespace namespace : namespaces) {
        if (namespace != null && namespace.getURI() != null && namespace.getURI().equals(BioPAX3.ns.uri)) {
            itIsLevel3 = true;
            break;
        }
    }
    if (itIsLevel3) {
        PathwayReaderBiopax3 pathwayReader = new PathwayReaderBiopax3(context);
        pathwayModel = pathwayReader.parse(rootElement, true);
    } else {
        // if it's not level3 we assume it to be level2
        // TODO: once biopax version3 becomes dominant change the code to use that as the default
        PathwayReader pathwayReader = new PathwayReader(context);
        pathwayModel = pathwayReader.parse(rootElement, statusSupport);
    }
    pathwayModel.reconcileReferences(statusSupport);
    pathwayModel.refreshParentMap();
    return pathwayModel;
}
Also used : Element(org.jdom.Element) PathwayModel(org.vcell.pathway.PathwayModel) Namespace(org.jdom.Namespace)

Aggregations

PathwayModel (org.vcell.pathway.PathwayModel)11 Document (org.jdom.Document)5 Element (org.jdom.Element)4 RDFXMLContext (org.vcell.pathway.persistence.RDFXMLContext)4 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)3 File (java.io.File)3 URL (java.net.URL)3 Hashtable (java.util.Hashtable)3 PathwayData (cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayData)2 PathwayStringObject (cbit.vcell.client.desktop.biomodel.BioModelEditorPathwayCommonsPanel.PathwayStringObject)2 ZoomRangeException (cbit.gui.graph.GraphResizeManager.ZoomRangeException)1 BioModel (cbit.vcell.biomodel.BioModel)1 ActiveView (cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView)1 SimulationContext (cbit.vcell.mapping.SimulationContext)1 MathModel (cbit.vcell.mathmodel.MathModel)1 Model (cbit.vcell.model.Model)1 RedistributionVersion (cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionVersion)1 XmlParseException (cbit.vcell.xml.XmlParseException)1 PropertyVetoException (java.beans.PropertyVetoException)1 ArrayList (java.util.ArrayList)1