| Author | Topic |
Posts: 307
Location: Cambridge UK
Registered: February 2005
|
|
Re: More issues with history elements
|
02 Apr '12 01:53

|
 |
|
Hi,
The latest trunk should correct this, one test was missing for the rdf
namespace for the History element.
Cheers,
Nico
On 23/03/12 23:32, rbyrnes wrote:
> I have a test program that constructs a history for a model and a compartment. Here is the program and its output.
>
> The validator at www.sbml.org reports that the output is valid SBML, but there is a problem with the model history.
>
> I found that the warning could be avoided by hand editing all the Bag and li elements to rdf:Bag and rdf:li. Also, I needed to add a modification date element to the history for the compartment to avoid a second warning.
>
> Are there easier ways to avoid these issues?
>
> --JavaBob
>
> import java.io.*;
>
> import org.sbml.jsbml.*;
>
> public class TestCompartmentHistoryGeneration
> {
> public static void main( String[] args )
> {
> try
> {
> // Construct a model.
> SBMLDocument document = new SBMLDocument( 3, 1 );
> Model model = document.createModel( "modelid" );
> model.setMetaId( "modelmetaid" );
>
> // Add to the model history.
> History mh = model.getHistory( );
> Creator creator = new Creator( );
> creator.setGivenName( "Steve" );
> creator.setFamilyName( "Jobs" );
> mh.addCreator( creator );
> mh.setCreatedDate( new java.util.Date( ) );
>
> // Create a compartment and add to the compartment history.
> Compartment c1 = model.createCompartment( "c1" );
> c1.setMetaId( "compartmentmetaid" );
> c1.setConstant( true );
> History h = c1.getHistory( );
> Creator cCreator = new Creator( );
> cCreator.setGivenName( "Steve" );
> cCreator.setFamilyName( "Jobs" );
> h.addCreator( cCreator );
> h.setCreatedDate( new java.util.Date( ) );
> c1.setHistory( h );
>
> // Save to file.
> File saveF = new File( "E:\\testsbml\\testcompartmenthistory.sbml" );
> SBMLWriter writer = new SBMLWriter( );
> FileOutputStream stream = new FileOutputStream( saveF );
> writer.write( document, stream );
> }
> 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="modelid" metaid="modelmetaid">
> <annotation>
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:dcterms="http://purl.org/dc/terms/">
> <rdf:Description rdf:about="#modelmetaid">
> <dc:creator>
> <Bag>
> <li parseType="Resource">
> <vCard:N rdf:parseType="Resource">
> <vCard:Family>Jobs</vCard:Family>
> <vCard:Given>Steve</vCard:Given>
> </vCard:N>
> </li>
> </Bag>
> </dc:creator>
> <dcterms:created parseType="Resource">
> <dcterms:W3CDTF>2012-03-23T21:25:07Z</dcterms:W3CDTF>
> </dcterms:created>
> <dcterms:modified parseType="Resource">
> <dcterms:W3CDTF>2012-03-23T21:25:07Z</dcterms:W3CDTF>
> </dcterms:modified>
> </rdf:Description>
> </rdf:RDF>
> </annotation>
> <listOfCompartments>
> <compartment id="c1" constant="true" metaid="compartmentmetaid">
> <annotation>
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:dcterms="http://purl.org/dc/terms/">
> <rdf:Description rdf:about="#compartmentmetaid">
> <dc:creator>
> <Bag>
> <li parseType="Resource">
> <vCard:N rdf:parseType="Resource">
> <vCard:Family>Jobs</vCard:Family>
> <vCard:Given>Steve</vCard:Given>
> </vCard:N>
> </li>
> </Bag>
> </dc:creator>
> <dcterms:created parseType="Resource">
> <dcterms:W3CDTF>2012-03-23T21:25:07Z</dcterms:W3CDTF>
> </dcterms:created>
> </rdf:Description>
> </rdf:RDF>
> </annotation>
> </compartment>
> </listOfCompartments>
> </model>
> </sbml>
>
>
> ____________________________________________________________
> 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
|
|
|