예제 #1
0
 /**
  * Change the Class (RDF_TYPE) of a resource
  *
  * @access public
  * @author Jerome Bogaerts, <*****@*****.**>
  * @param  Resource instance
  * @param  Class destinationClass
  * @return boolean
  */
 public function changeClass(core_kernel_classes_Resource $instance, core_kernel_classes_Class $destinationClass)
 {
     $returnValue = (bool) false;
     try {
         foreach ($instance->getTypes() as $type) {
             $instance->removeType($type);
         }
         $instance->setType($destinationClass);
         foreach ($instance->getTypes() as $type) {
             if ($type->getUri() == $destinationClass->getUri()) {
                 $returnValue = true;
                 break;
             }
         }
     } catch (common_Exception $ce) {
         print $ce;
     }
     return (bool) $returnValue;
 }