SynBioDex / SBOL-utilities

Command-line utilities and scripts for manipulating SBOL data
MIT License
15 stars 21 forks source link

handle None namespace and version suffix in conversion #285

Open fxbuson opened 1 month ago

fxbuson commented 1 month ago

As mentioned in Issue #283, the current version of the converter doesn't know how to handle identities that end in the version number. You get these in the case of using sbol2.ConfigOptions.SBOL_COMPLIANT_URIS as True, so I added a function _sbol3_identity() to be used whenever converting an identity value from sbol2 to sbol3, and exchanged each case of an sbol3 object being assigned an identity to use that function.

The converter also didn't include the version number in the identity when converting back to sbol2, so I included that in _convert_identified(). Note that this will default to '1', as per the SBOL 3.1.0 specification, section 10.2, item 3:

When SBOL 3.x Identified object is converted to SBOL 2.x, if its identity is a URL, then the identity of the SBOL 2.x object SHOULD be constructed as [SBOL3 identity]/[SBOL2 version]. If the object does not have an SBOL2 version property, then its version SHOULD default to 1.

Another problem I ran into was with None namespaces when converting to sbol3, so I added that case to _sbol3_namespace().

Now, my conversion of a simple document with an example ComponentDefinition should work. The roundtrip will enforce the use of the version at the end of the object's identity though, overriding the option sbol2.ConfigOptions.SBOL_COMPLIANT_URIS if it was set to False

PrashantVaidyanathan commented 1 month ago

@jakebeal @tcmitchell - Just wanted to tag you in this. Are you happy with this?