SynBioDex / pySBOL3

Native python implementation of SBOL 3.0 specification
MIT License
37 stars 16 forks source link

Using default namespace results in object without a namespace #263

Closed tcmitchell closed 3 years ago

tcmitchell commented 3 years ago

Note below that c.namespace is None, and that validation results in errors about the lack of a namespace.

>>> import sbol3
RDFLib Version: 5.0.0
>>> c = sbol3.Component('foo', sbol3.SBO_DNA)
/Users/tmitchel/Projects/sd2/pySBOL3/sbol3/object.py:70: UserWarning: Using a default namespace. To set a namespace use set_namespace()
  warnings.warn('Using a default namespace.'
>>> c.namespace
>>> c.namespace is None
True
>>> doc = sbol3.Document()
>>> doc.add(c)
>>> report = doc.validate()
>>> len(report)
3
>>> for i in report:
...     print(i)
... 
http://sbols.org/unspecified_namespace/foo: Too few values for property namespace. Expected 1, found 0
http://sbols.org/unspecified_namespace/foo: Less than 1 values on <http://sbols.org/unspecified_namespace/foo>->:hasNamespace
http://sbols.org/unspecified_namespace/foo: Less than 1 values on <http://sbols.org/unspecified_namespace/foo>->:hasNamespace
>>>