libsbml
libsbml copied to clipboard
Support for rdf:_1, rdf:_2
The following annotation is valid XML but it cannot be added as an annotation. The function removes the rdf:_1 elements. However, if these are replaced with rdf:li the annotation works.
<rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="#compa_rtment">
<dc:creator>
<rdf:Bag>
<rdf:_1>
<vCard:N>
<vCard:Family>family</vCard:Family>
<vCard:Given>name</vCard:Given>
</vCard:N>
</rdf:_1>
<rdf:_2>
<vCard:N>
<vCard:Family>family</vCard:Family>
<vCard:Given>name</vCard:Given>
</vCard:N>
</rdf:_2>
</rdf:Bag>
</dc:creator>
<dcterms:created>
<dcterms:W3CDTF rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2021-07-23T18:53:16.625065+02:00</dcterms:W3CDTF>
</dcterms:created>
<dcterms:modified>
<dcterms:W3CDTF rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2021-07-23T18:53:16.625065+02:00</dcterms:W3CDTF>
</dcterms:modified>
</rdf:Description>
</rdf:RDF>
This is how the annotation looks after being added. You can see that the Bag under creator is empty:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:vCard4="http://www.w3.org/2006/vcard/ns#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#modelname">
<dcterms:creator>
<rdf:Bag/>
</dcterms:creator>
<dcterms:created rdf:parseType="Resource">
<dcterms:W3CDTF>2021-07-23T18:53:16Z</dcterms:W3CDTF>
</dcterms:created>
<dcterms:modified rdf:parseType="Resource">
<dcterms:W3CDTF>2021-07-23T18:53:16Z</dcterms:W3CDTF>
</dcterms:modified>
</rdf:Description>
</rdf:RDF>
Useful reference regarding RDF/XML. https://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-list-elements
RDF has a set of container membership properties and corresponding property elements that are mostly used with instances of the rdf:Seq, rdf:Bag and rdf:Alt classes which may be written as typed node elements. The list properties are rdf:_1, rdf:_2 etc. and can be written as property elements or property attributes as shown in Example 17. There is an rdf:li special property element that is equivalent to rdf:_1, rdf:_2 in order, explained in detail in section 7.4. The mapping to the container membership properties is always done in the order that the rdf:li special property elements appear in XML — the document order is significant. The equivalent RDF/XML to Example 17 written in this form is shown in Example 18.
libsbml, implements support for the subset of RDF as outlined in section 6 of the SBML specification. It was meant to provide a subset, for which applications not supporting the full RDF set.
I've transferred the issue here, as this issue is independent of the python version.
Although rdf:li is supported in RDF/XML,rdf:li is not part of the RDF schema and list elements are written as rdf:_1 and rdf:_2, I think it would make sense to support XML annotations written as rdf:_1 at least internally for the function appendAnnotation, so that is then converted to rdf:li. appendAnnotation makes a lot of silent decisions without warning the user, for example removing nodes that it doesn't support as seen above.