When an RDF resource declares a namespace, that namespace is applied globally in _start_ns_declaration_handler of RdfParser.php.
This is contrary to Namespaces in XML1.0 (Second Edition), 6.1 which says "The scope of a namespace declaration declaring a prefix extends from the beginning of the start-tag in which it appears to the end of the corresponding end-tag, excluding the scope of any inner declarations with the same NSAttName part. In the case of an empty tag, the scope is the tag itself."
The attached vCard illustrates the problem: ns0pred is used locally for both the rdf and vCard namespaces in different elements. RAP ends up globally using ns0pred for both rdf and vCard namespaces.
Sample code:
<?php
$model = ModelFactory::getDefaultModel();
$model->load("input.rdf");
echo($model->writeRdfToString());
?>
Sample vCard
Sample code output
Logged In: YES
user_id=1383215
Originator: YES
File Added: output.rdf