use of org.jdom.Document in project vcell by virtualcell.
the class PathwayReaderBiopax3 method main.
public static void main(String[] args) {
try {
// usual testing pathway
Document document = XmlUtil.readXML(new File("C:\\dan\\reactome biopax\\Reactome3_189445.owl"));
// infinite recursion between pathway steps
// http://www.pathwaycommons.org/pc/webservice.do?cmd=get_record_by_cpath_id&version=2.0&q=826249&output=biopax
// Document document = XmlUtil.readXML(new File("C:\\dan\\reactome biopax\\recursive.owl"));
PathwayReaderBiopax3 pathwayReader = new PathwayReaderBiopax3(new RDFXMLContext());
System.out.println("starting parsing");
PathwayModel pathwayModel = pathwayReader.parse(document.getRootElement(), true);
System.out.println("ending parsing");
pathwayModel.reconcileReferences(null);
System.out.println(pathwayModel.show(false));
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
use of org.jdom.Document in project vcell by virtualcell.
the class OptXmlReader method stringToXML.
public static Element stringToXML(String xmlString) {
try {
StringReader reader = new StringReader(xmlString);
SAXBuilder builder = new SAXBuilder();
Document sDoc = builder.build(reader);
Element root = sDoc.getRootElement();
return root;
} catch (JDOMException e) {
e.printStackTrace();
throw new RuntimeException("source document is not well-formed\n" + e.getMessage());
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException("Unable to read source document\n" + e.getMessage());
}
}
use of org.jdom.Document in project vcell by virtualcell.
the class PathwayXMLHelper method getElementPathString.
private static String getElementPathString(Element childElement) {
StringBuffer buffer = new StringBuffer();
Element element = childElement;
while (element != null) {
if (buffer.length() == 0) {
buffer.append(element.getName());
} else {
buffer.insert(0, element.getName() + "/");
}
Parent parent = element.getParent();
if (parent instanceof Element) {
element = (Element) parent;
} else if (parent instanceof Document) {
return buffer.toString();
} else {
return buffer.toString();
}
}
return buffer.toString();
}
use of org.jdom.Document in project vcell by virtualcell.
the class PathwayEntryReader method main.
public static void main(String[] args) {
try {
Document document = XmlUtil.readXML(new File("C:\\dan\\reactome biopax\\PathwayCommons.xml"));
PathwayEntryReader pathwayReader = new PathwayEntryReader();
System.out.println("starting parsing");
PathwayEntryModel pathwayModel = pathwayReader.parse(document.getRootElement());
System.out.println("ending parsing");
System.out.println(pathwayModel.show(true));
System.out.println("Summary: ");
System.out.println(" " + pathwayModel.getPathwayEntryObjects().size() + " elements.");
System.out.println(" " + pathwayReader.numDuplicates + " duplicates.");
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
use of org.jdom.Document in project vcell by virtualcell.
the class PathwayBiopax3Test method main.
public static void main(String[] args) {
try {
// sbpax: http://www.signaling-gateway.org/molecule/query?afcsid=A000037&type=sbPAXExport
// items within items
// Document document = XmlUtil.readXML(new File("C:\\dan\\reactome biopax\\sbpax3fullexample.xml"));
// biopax with URI-like IDs and resources
// http://www.pathwaycommons.org/pc2/get?uri=HTTP:%2F%2FWWW.REACTOME.ORG%2FBIOPAX/48887%23PATHWAY1076_1_9606
// sbpax3_uri_id.xml
Document document = XmlUtil.readXML(new File("C:\\dan\\reactome biopax\\biopax3_no_id.xml"));
// Document document = XmlUtil.readXML(new File("C:\\dan\\reactome biopax\\SBPax3.owl"));
// Document document = XmlUtil.readXML(new File("C:\\dan\\reactome biopax\\Reactome3_189445.owl"));
PathwayReaderBiopax3 pathwayReader = new PathwayReaderBiopax3(new RDFXMLContext());
PathwayModel pathwayModel = pathwayReader.parse(document.getRootElement(), true);
// System.out.print(pathwayModel.show(true));
pathwayModel.reconcileReferences(null);
bioModelToXML(pathwayModel);
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
Aggregations