SynBioDex / pySBOL2

A pure Python implementation of the SBOL standard.
Apache License 2.0
21 stars 7 forks source link

Round-trip is not idempotent #358

Closed bbartley closed 4 years ago

bbartley commented 4 years ago
>>> cd =doc.componentDefinitions.create('cd')
>>> c = cd.components.create('c')
>>> len(cd.components)
1
>>> doc.readString(doc.writeString())
>>> len(cd.components)
2
>>> cd = doc.componentDefinitions[cd.identity]
>>> len(cd.components)
2
bbartley commented 4 years ago

To clarify the expected behavior here read and readString should completely wipe the Document contents before importing new objects. With the current behavior, the child Component object gets duplicated upon round trip

jakebeal commented 4 years ago

Needs to be split into two issues: 1) readString should not do a merge 2) merge operations are broken and need to be reorganized

@bbartley , please reorganize appropriately

tcmitchell commented 4 years ago

We need to document the contract of the read() and readString() methods. Both clear the document and then load the new information.

tcmitchell commented 4 years ago

PartShop.pull() uses Document.readString(). That means we'll want to add Document.appendString() to serve the role Document.readString() had been playing. And then convert PartShop.pull() to use Document.appendString().

IGEM_STANDARD_ASSEMBLY() also uses Document.readString() so that needs to change as well.