Closed tramyn closed 3 years ago
pysbol2 does not have an exported parse_namespace
or parseNamespace
function. There is also no utils
submodule in pysbol2. There is a parseNamespace
function internal to pysbol2, however. The reason it is not exported is that it is a heuristic that might or might not properly determine the namespace of a URI. As such, its use is limited internally to pysbol2, and is not exported from the pysbol2 module.
If you want a function that heuristically guesses a namespace from an object's URI, you'll want to define that function yourself. You could use one of the two definitions in pysbol2 as a basis for yours or do it a different way. The fact that pysbol2 has two different parseNamespace
functions internally demonstrates that this is a heuristic that just isn't a good idea. The two definitions are:
I have no plans to support a namespace parsing function in pysbol3. Section 5.1 of the SBOL3 specification says that TopLevel URLs use the following pattern: [namespace]/[local]/[displayId]
. There is no way to determine when the namespace ends and the "local" portion of the URL/URI begins, or if the "local" portion even exists.
Following the URL/URI example in Section 5.1, which is https://synbiohub.org/public/igem/BBa_J23070
, the two parseNamespace functions in pysbol2 would probably say that the namespace is https://synbiohub.org/public/igem
and they would be wrong. The spec says the namespace is https://synbiohub.org
. The namespace could just as easily be https://synbiohub.org/public
too. This confusion is why it is a bad idea for pysbol2 and pysbol3 to export a parse_namespace
function.
This might get better with the new Namespace definition in the upcoming SBOL3 3.0.1 specification. But until that is published we won't really know.
I believe that with 3.0.1, we'll end up with a namespace field on each object, which will make it just a field access. We should formalize this by the end of HARMONY
Hearing no reply I will close this issue. If you have any questions about this, please reopen and add a comment.
I want to get a namespace from toplevel object. @bbartley mentioned that pysbol2 supports this feature by peforming the following:
I would like to request this feature supported in pysbol3.