Forums

F.A.Q. F.A.Q.    Register Register    Login Login    Home Home
Search Search
SBML Discussions » jsbml-development » SBML namespace in math elements
Show: Today's Posts  :: Message Navigator
| Subscribe to topic 
Return to the default flat view Create a new topic Submit Reply
AuthorTopic
rbyrnes


Posts: 28
Registered:
September 2008
SBML namespace in math elements 27 Mar '12 13:53 Go to previous message

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?

--JavaBob

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

      

SubjectPosterDate
Read Message   SBML namespace in math elements  rbyrnes27 Mar '12 13:53
Read Message   Re: SBML namespace in math elements rodrigue28 Mar '12 08:33
Previous Topic:infix survey
Next Topic:Problem reading history element?
Go to forum:
-=] Back to Top [=-

Powered by FUDforum. (Copyright Advanced Internet Designs Inc.)

Please use our issue tracking system for any questions or suggestions about this website.