public void updateNamespaces ( Document document ) { Namespace rootNamespace = Namespace . gatherNamespaces ( document ) ; document . setNamespace ( rootNamespace ) ; for ( org . openprovenance . prov . model . Bundle bu : utils . getBundle ( document ) ) { Namespace ns = bu . getNamespace ( ) ; if ( ns != null ) { ns . setParent ( rootNamespace ) ; } else { ns = new Namespace ( ) ; ns . setParent ( rootNamespace ) ; bu . setNamespace ( ns ) ; } } }
After reading a document this method should be called to ensure that Namespaces are properly chained .