Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle None namespace and version suffix in conversion #285

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

fxbuson
Copy link
Collaborator

@fxbuson fxbuson commented Sep 4, 2024

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

Created a function that strips the end of the identity when converting to sbol3 in case it ends with the version number (as per the sbol2.3 specification)

Added this conversion to all implemented objects

Added roundtrip inclusion of sbol2version in the sbol2 identity. Defaults to "1"
@fxbuson fxbuson added the bug Something isn't working label Sep 4, 2024
@fxbuson fxbuson added this to the Python SBOL2-3 Converter milestone Sep 4, 2024
@PrashantVaidyanathan
Copy link

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

also properly determining identities in toplevel objects
Copy link
Contributor

@jakebeal jakebeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs to have the GitHub action tests run on it (turn them on in your fork) and needs to have new test cases added that are capable of reproducing the failures in #283 if these changes are not added.

@@ -73,6 +73,10 @@ def _convert_identified(self, obj3: sbol3.Identified, obj2: sbol2.Identified):
obj2.description = self._value_or_property(obj3, obj3.description, 'http://purl.org/dc/terms/description')
obj2.wasDerivedFrom = obj3.derived_from
obj2.wasGeneratedBy = obj3.generated_by

# Add version to identity
obj2.identity = obj2.identity + "/" + obj3.sbol2_version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's safe to assume that the sbol2_version property is necessarily set.

sbol_utilities/sbol3_sbol2_conversion.py Outdated Show resolved Hide resolved
fxbuson and others added 5 commits September 27, 2024 10:53
dropped python versions 3.7 and 3.8 (reaching EOL by the end of the year) and adding 3.12
as described in issue 283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants