public static function getInstance() { if (self::$INSTANCE == NULL) { global $smwgDefaultRuleStore; self::$INSTANCE = !isset($smwgDefaultRuleStore) ? new SMWRuleStore() : new $smwgDefaultRuleStore(); } return self::$INSTANCE; }
function changeTitle(Title $oldtitle, Title $newtitle, $pageid, $redirid = 0) { $this->smwstore->changeTitle($oldtitle, $newtitle, $pageid, $redirid); $old_ns = $this->tsNamespace->getNSPrefix($oldtitle->getNamespace()); $new_ns = $this->tsNamespace->getNSPrefix($newtitle->getNamespace()); // update local rule store global $smwgEnableObjectLogicRules; if (isset($smwgEnableObjectLogicRules)) { SMWRuleStore::getInstance()->updateRules($redirid, $pageid); } // update triple store global $smwgMessageBroker, $smwgTripleStoreGraph; try { $con = TSConnection::getConnector(); $sparulCommands = array(); $sparulCommands[] = TSNamespaces::getW3CPrefixes() . "MODIFY <{$smwgTripleStoreGraph}> DELETE { <{$smwgTripleStoreGraph}/{$old_ns}#" . $oldtitle->getDBkey() . "> ?p ?o. } INSERT { <{$smwgTripleStoreGraph}/{$new_ns}#" . $newtitle->getDBkey() . "> ?p ?o. }"; $sparulCommands[] = TSNamespaces::getW3CPrefixes() . "MODIFY <{$smwgTripleStoreGraph}> DELETE { ?s <{$smwgTripleStoreGraph}/{$old_ns}#" . $oldtitle->getDBkey() . "> ?o. } INSERT { ?s <{$smwgTripleStoreGraph}/{$new_ns}#" . $newtitle->getDBkey() . "> ?o. }"; $sparulCommands[] = TSNamespaces::getW3CPrefixes() . "MODIFY <{$smwgTripleStoreGraph}> DELETE { ?s ?p <{$smwgTripleStoreGraph}/{$old_ns}#" . $oldtitle->getDBkey() . ">. } INSERT { ?s ?p <{$smwgTripleStoreGraph}/{$new_ns}#" . $newtitle->getDBkey() . ">. }"; $con->connect(); $con->update("/topic/WIKI.TS.UPDATE", $sparulCommands); $con->disconnect(); } catch (Exception $e) { } }