trungdong/prov

ProvDocument.set_default_namespace doesn't add to namespaces list

Closed this issue · 1 comments

Is this the expected behaviour?

In the first example the document doesn't have any namespaces in doc1.namespaces (it's an empty set set())

import prov.model

# Use default namespace
doc1 = prov.model.ProvDocument()
doc1.set_default_namespace('http://example.org/')
print(doc1.namespaces) # =>
# set()
print(doc1.get_provn()) # =>
# document
#   default <http://example.org/>
# 
# endDocument

This example does have namespaces defined.

# Don't use default
doc2 = prov.model.ProvDocument()
doc2.add_namespace('ex', 'http://example.org/')
print(doc2.namespaces) # =>
# {<Namespace: ex {http://example.org/}>}
print(doc2.get_provn())
# document
#   prefix ex <http://example.org/>
# 
# endDocument

I'm new to RDF and PROV, but it seems odd to me that the first example doesn't have the namespace included in doc1.namespaces.

Yes, I think that I intended for the property to provide the list of registered namespaces, which means namespaces with a specified prefix.

The default namespace is a special instruction to a document on how to interpret unprefixed qualified names and, hence, not included in the list of registered namespaces.