Java Code Examples for org.jdom.Element#setNamespace()
The following examples show how to use
org.jdom.Element#setNamespace() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertiesUtil.java From iBioSim with Apache License 2.0 | 4 votes |
static Algorithm getAlgorithm(AnalysisProperties properties) { Algorithm algorithm = null; Element para = new Element("analysis"); String sim = properties.getSim(); para.setNamespace(Namespace.getNamespace("http://www.async.ece.utah.edu/iBioSim")); if (properties.isOde()) { if (sim.contains("euler")) { algorithm = new Algorithm(GlobalConstants.KISAO_EULER); } else if (sim.contains("rk8pd")) { algorithm = new Algorithm(GlobalConstants.KISAO_RUNGE_KUTTA_PRINCE_DORMAND); } else if (sim.contains("rkf45") || sim.contains("Runge-Kutta-Fehlberg")) { algorithm = new Algorithm(GlobalConstants.KISAO_RUNGE_KUTTA_FEHLBERG); para.setAttribute("method", sim); } else { algorithm = new Algorithm(GlobalConstants.KISAO_RUNGE_KUTTA_FEHLBERG); para.setAttribute("method", sim); } } else if (properties.isSsa()) { if (sim.equals("gillespie")) { algorithm = new Algorithm(GlobalConstants.KISAO_GILLESPIE_DIRECT); } else if (sim.contains("Mixed")) { algorithm = new Algorithm(GlobalConstants.KISAO_DFBA_SOA); } else if (sim.contains("Hierarchical")) { algorithm = new Algorithm(GlobalConstants.KISAO_GILLESPIE_DIRECT); } else if (sim.contains("SSA-CR")) { algorithm = new Algorithm(GlobalConstants.KISAO_SSA_CR); } else { algorithm = new Algorithm(GlobalConstants.KISAO_GILLESPIE_DIRECT); para.setAttribute("method", sim); if (sim.equals("iSSA")) { if (properties.getIncrementalProperties().isMpde()) { para.setAttribute("type", "mpde"); } else if (properties.getIncrementalProperties().isMeanPath()) { para.setAttribute("type", "meanPath"); } else if (properties.getIncrementalProperties().isMedianPath()) { para.setAttribute("type", "medianPath"); } if (properties.getIncrementalProperties().isAdaptive()) { para.setAttribute("adaptive", "true"); } else { para.setAttribute("adaptive", "false"); } para.setAttribute("numPaths", String.valueOf(properties.getIncrementalProperties().getNumPaths())); } } } else if (properties.isFba()) { algorithm = new Algorithm(GlobalConstants.KISAO_FBA); } else { algorithm = new Algorithm(GlobalConstants.KISAO_GENERIC); if (properties.isSbml()) { para.setAttribute("method", "Model"); } else if (properties.isDot()) { para.setAttribute("method", "Network"); } else if (properties.isXhtml()) { para.setAttribute("method", "Browser"); } else { para.setAttribute("method", sim); } } if (properties.isExpand()) { para.setAttribute("abstraction", "Expand Reactions"); } else if (properties.isAbs()) { para.setAttribute("abstraction", "Reaction-based"); } else if (properties.isNary()) { para.setAttribute("abstraction", "State-based"); } para.setAttribute("rapid1", String.valueOf(properties.getAdvancedProperties().getRap1())); para.setAttribute("rapid2", String.valueOf(properties.getAdvancedProperties().getRap2())); para.setAttribute("qssa", String.valueOf(properties.getAdvancedProperties().getQss())); para.setAttribute("maxConc", String.valueOf(properties.getAdvancedProperties().getCon())); para.setAttribute("stoichAmp", String.valueOf(properties.getAdvancedProperties().getStoichAmp())); Annotation ann = new Annotation(para); algorithm.addAnnotation(ann); SimulationProperties simProperties = properties.getSimulationProperties(); AlgorithmParameter ap = new AlgorithmParameter(GlobalConstants.KISAO_MINIMUM_STEP_SIZE, String.valueOf(simProperties.getMinTimeStep())); algorithm.addAlgorithmParameter(ap); ap = new AlgorithmParameter(GlobalConstants.KISAO_MAXIMUM_STEP_SIZE, String.valueOf(simProperties.getMaxTimeStep())); algorithm.addAlgorithmParameter(ap); ap = new AlgorithmParameter(GlobalConstants.KISAO_ABSOLUTE_TOLERANCE, String.valueOf(simProperties.getAbsError())); algorithm.addAlgorithmParameter(ap); ap = new AlgorithmParameter(GlobalConstants.KISAO_RELATIVE_TOLERANCE, String.valueOf(simProperties.getRelError())); algorithm.addAlgorithmParameter(ap); ap = new AlgorithmParameter(GlobalConstants.KISAO_SEED, String.valueOf(simProperties.getRndSeed())); algorithm.addAlgorithmParameter(ap); ap = new AlgorithmParameter(GlobalConstants.KISAO_NUMBER_OF_RUNS, String.valueOf(simProperties.getRun() + (simProperties.getStartIndex() - 1))); algorithm.addAlgorithmParameter(ap); return algorithm; }
Example 2
Source File: QueryResultImpl.java From sparql-dl-api with GNU Lesser General Public License v3.0 | 4 votes |
/** * Output query results as JDOM XML document containing the standard * SPARQL query results XML format (http://www.w3.org/TR/rdf-sparql-XMLres/). * Supports both: Variable binding results and Boolean results. * * @return A JDOM XML document. */ public Document toXML() { Element sparql = new Element("sparql"); sparql.setNamespace(Namespace.getNamespace("http://www.w3.org/2005/sparql-results#")); // generate head Element head = new Element("head"); if(!bindings.isEmpty()) { QueryBinding top = bindings.get(0); for(QueryArgument arg : top.getBoundArgs()) { if(arg.isVar()) { Element var = new Element("variable"); var.setAttribute("name", arg.getValueAsString()); head.addContent(var); } } } sparql.addContent(head); if(query.isAsk()) { Element booleanElement = new Element("boolean"); if(ask) { booleanElement.setText("true"); } else { booleanElement.setText("false"); } sparql.addContent(booleanElement); } else { // otherwise generate results Element results = new Element("results"); for(QueryBinding binding : bindings) { Element result = new Element("result"); for(QueryArgument key : binding.getBoundArgs()) { if(key.isVar()) { Element b = new Element("binding"); b.setAttribute("name", key.getValueAsString()); QueryArgument value = binding.get(key); switch(value.getType()) { case URI: Element uri = new Element("uri"); uri.setText(value.getValueAsIRI().toString()); b.addContent(uri); break; case LITERAL: Element literal = new Element("literal"); literal.setText(value.getValueAsLiteral().getLiteral()); b.addContent(literal); break; case BNODE: Element bnode = new Element("bnode"); bnode.setText(value.getValueAsBNode().getID().toString()); b.addContent(bnode); break; default: } result.addContent(b); } } results.addContent(result); } sparql.addContent(results); } return new Document(sparql); }
Example 3
Source File: XmlHelper.java From rice with Educational Community License v2.0 | 4 votes |
public static void propagateNamespace(Element element, Namespace namespace) { element.setNamespace(namespace); for (Object childElement : element.getChildren()) { propagateNamespace((Element) childElement, namespace); } }
Example 4
Source File: EDocLiteXmlExporter.java From rice with Educational Community License v2.0 | 4 votes |
private void setNamespace(Element element, Namespace namespace) { element.setNamespace(namespace); for (Iterator iter = element.getChildren().iterator(); iter.hasNext();) { setNamespace((Element)iter.next(), namespace); } }