| Author | Topic |
Posts: 307
Location: Cambridge UK
Registered: February 2005
|
|
Re: SBML namespace in math elements
|
28 Mar '12 08:33
|
 |
|
On 28/03/12 14:37, rbyrnes wrote:
> The version of JSBML that I am testing has a problem with the SBML namespace in math elements. Here is a test program, along with a test file containing a math element, and the output of the program.
>
> JSBML reads the math element, but it doesn't keep the SBML namespace, at least at the level of the math element. Coding would be easier if was kept. Is there a workaround for this?
In your example file, the sbml namespace is mispelled (there is a typo).
I think this might make the sbml:units being ignored but I did not try
to run the program yet.
In general, if they are units define inside an ASTNode, the SBMLWriter
would add automatically the sbml namespace on the math element.
Cheers,
Nico
>
>
> import java.io.*;
> import java.util.*;
> import javax.xml.stream.XMLStreamException;
> import org.sbml.jsbml.*;
>
> public class ConstraintMathMLTest
> {
> public static void main( String[] args )
> {
> try
> {
> File f = null;
> SBMLDocument document = null;
> try
> {
> f = new File( "E:\\testsbml\\testConstraintMathML.sbml");
> document = SBMLReader.read( f);
> Model m = document.getModel( );
> ListOf<Constraint> cList = m.getListOfConstraints( );
> Iterator<Constraint> cIt = cList.iterator( );
> while ( cIt.hasNext( ) )
> {
> Constraint c = (Constraint) cIt.next( );
> System.out.println( c.getMathMLString( ) );
> }
> }
> catch( java.util.EmptyStackException e )
> {
> throw new IOException( e.getMessage( ) );
> }
> catch( XMLStreamException x )
> {
> throw new IOException( x.getMessage( ) );
> }
> }
> catch( Exception ex )
> {
> ex.printStackTrace( );
> }
> System.out.println( "Done" );
> }
> }
>
> <?xml version='1.0' encoding='UTF-8' standalone='no'?>
> <sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" level="3" version="1">
> <model id="aa" metaid="_3caf62a9-a308-4b32-ac55-8d01de8e0f3a">
> <annotation>
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/">
> <rdf:Description rdf:about="#_3caf62a9-a308-4b32-ac55-8d01de8e0f3a">
> <dcterms:created parseType="Resource">
> <dcterms:W3CDTF>2012-03-22T18:21:20Z</dcterms:W3CDTF>
> </dcterms:created>
> <dcterms:modified parseType="Resource">
> <dcterms:W3CDTF>2012-03-22T18:24:00Z</dcterms:W3CDTF>
> </dcterms:modified>
> </rdf:Description>
> </rdf:RDF>
> </annotation>
> <listOfConstraints metaid="_066de0a8-4753-402a-b93c-e5ae3ab068d5">
> <annotation>
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <rdf:Description rdf:about="#_066de0a8-4753-402a-b93c-e5ae3ab068d5">
> </rdf:Description>
> </rdf:RDF>
> </annotation>
> <constraint>
> <annotation>
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <rdf:Description rdf:about="#_066de0a8-4753-402a-b93c-e5ae3ab06xyz">
> </rdf:Description>
> </rdf:RDF>
> </annotation>
> <math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:sbml="http://www.sbml.org/sbml/level3/version1core">
> <apply>
> <and/>
> <apply>
> <lt/>
> <cn sbml:units="mole"> 1</cn>
> <ci> S1</ci>
> </apply>
> <apply>
> <lt/>
> <ci> S1</ci>
> <cn sbml:units="mole"> 100</cn>
> </apply>
> </apply>
> </math>
> </constraint>
> </listOfConstraints>
> </model>
> </sbml>
>
> Here is the output of the program:
>
> <?xml version='1.0' encoding='UTF-8'?>
> <math xmlns="http://www.w3.org/1998/Math/MathML">
> <apply>
> <and/>
> <apply>
> <lt/>
> <cn sbml:units="mole"> 1</cn>
> <ci> S1</ci>
> </apply>
> <apply>
> <lt/>
> <ci> S1</ci>
> <cn sbml:units="mole"> 100</cn>
> </apply>
> </apply>
> </math>
> Done
> ____________________________________________________________
> To manage your jsbml-development list subscription, visit
> https://utils.its.caltech.edu/mailman/listinfo/jsbml-development
>
> For a web interface to the jsbml-development mailing list, visit
> http://sbml.org/Forums/
>
> For questions or feedback about the jsbml-development list,
> contact sbml-team@caltech.edu
____________________________________________________________
To manage your jsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/jsbml-development
For a web interface to the jsbml-development mailing list, visit
http://sbml.org/Forums/
For questions or feedback about the jsbml-development list,
contact sbml-team@caltech.edu
|
|
|