/**
  * tests _resNode2Node()
  */
 function test_resNode2NodeTest()
 {
     $_SESSION['test'] = 'ResModel _resNode2Node test';
     $model1 = new MemModel();
     $resmodel = new ResModel($model1);
     $resLit = new ResLiteral('Literal', 'DE');
     $resLit->setDatatype('type');
     $result = $resmodel->_resNode2Node($resLit);
     $this->assertIsA($result, 'Literal');
     $this->assertEqual($result->getLanguage(), 'DE');
     $this->assertEqual($result->getDatatype(), 'type');
     $model1->close();
 }
示例#2
0
 /** 
  * converts a Resource,Blanknode,Literal into a ResResource, ResProperty, or ResLiteral
  *
  * @param	object Node	$node
  * @param	boolean		$isProperty
  * @return	object ResResource / ResProperty / ResLiteral
  * @access	private
  * @throws phpErrpr
  */
 function _node2ResNode($node, $isProperty = false)
 {
     if (is_a($node, 'Literal')) {
         $return = new ResLiteral($node->getLabel(), $node->getLanguage());
         $return->setDatatype($node->getDatatype());
         $return->setAssociatedModel($this);
         return $return;
     }
     if (is_a($node, 'Resource')) {
         if ($isProperty) {
             $res = new ResProperty($node->getLabel());
         } else {
             $res = new ResResource($node->getLabel());
         }
         $res->setAssociatedModel($this);
         if (is_a($node, 'Blanknode')) {
             $res->setIsAnon(true);
         }
         return $res;
     }
 }