How to create an SBML document with empty listOfs ?

9 views
Skip to first unread message

Matthias König

unread,
Feb 7, 2019, 12:22:16 PM2/7/19
to libsbml-development
Hi all,

is it possible to create the empty listOfs within the XML serialization of an SBMLDocument with libsbml?
Example given:
I have an SBMLDocument without any FunctionDefinitions. When I write the SBMLDocument to file I would like to have a

<listOfFunctionDefinitions />
or
<listOfFunctionDefinitions></listOfFunctionDefinitions>

in the SBML file.
Can I set some settings so that all possible lists are written out in the file (even the empty ones)?

When I create new objects with libsbml the lists are created, but is there any way to create the lists without any objects in them, or provide some settings to the serializer that it writes out all the empty lists?

Best Matthias

Matthias König

unread,
Feb 8, 2019, 4:11:55 AM2/8/19
to LibSBML Development List
Hi all,
I just realized I am not allowed to have emtpy listOfs in SBML and there are some validation rules for this.
```
The <listOf___> containers in a <model> are optional, but if present, the lists cannot be empty.
```
So issue is solved. This would just not be valid SBML.
Best Matthias

--
You received this message because you are subscribed to a topic in the Google Groups "libsbml-development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/libsbml-development/FSz7FrWZEVA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to libsbml-develop...@googlegroups.com.
To post to this group, send email to libsbml-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/libsbml-development/f1a96721-f23c-49b4-bf3c-b49f1569d635%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matthias König, PhD.
Junior Group Leader LiSyM - Systems Medicine of the Liver
Humboldt Universität zu Berlin, Institute of Biology, Institute for Theoretical Biology
  https://livermetabolism.com
koni...@googlemail.com
https://github.com/matthiaskoenig
Tel: +49 30 2093 98435

Keating, Sarah M.

unread,
Feb 8, 2019, 5:05:51 AM2/8/19
to libsbml-d...@googlegroups.com
Hi Matthias

Empty listOfs are actually allowed in L3V2.

So if you wanted to show them in the example it would need to be L3V2.

libSBML does not have a function to force a write to display empty
listOfs (maybe we should!) but it will roundtrip an empty listOf. So if
you hand wrote an file with the empty listOfs you want displayed, read
that in and used that to create your model you would get any empty
listOfs that had been in the read in model.

Although that is not really any different than adding the empty listOfs
manually after you create the model :-)

I tried a couple of hacks - like creating a FunctionDefinition in the
model and then removing it but it does not produce an empty listOf
element. I'll add this to our tracker.

Sarah
>> <https://groups.google.com/d/msgid/libsbml-development/f1a96721-f23c-49b4-bf3c-b49f1569d635%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .

Matthias König

unread,
Mar 14, 2019, 5:18:38 AM3/14/19
to libsbml-development
Hi all,
this is solved. Thanks for all the help.
Best Matthias
Reply all
Reply to author
Forward
0 new messages