/**
  * tests if contains returns false if the given statement is not in the MemModel
  * using all kinds of indices.
  */
 function testContainsFalse()
 {
     $_SESSION['test'] = 'ResModel contains false test';
     for ($i = -1; $i < 4; $i++) {
         $mod = $this->_generateModel(3, $i);
         $resmodel = new ResModel($mod);
         $statTest = new Statement(new ResResource('http://www.example.org/subX'), new ResResource('http://www.example.org/pred2'), new ResResource('http://www.example.org/obj2'));
         $this->assertFalse($resmodel->contains($statTest));
     }
 }
Example #2
0
 /**
  * Delete all the statements with predicate p for this resource from 
  * its associated model.
  *
  * @access	public 
  * @param	object	resource $property
  * @return	object ResResource 
  */
 function removeAll($property = null)
 {
     foreach ($this->model->find($this, $property, null) as $statement) {
         $this->model->remove($statement);
     }
     return $this;
 }
Example #3
0
 /**
  * Constructor.
  * You have to supply a memmodel/dbmodel/infmodel to save the statements and a vocabulary
  *
  * @param object Model $model 
  * @access	public
  */
 function OntModel(&$model, &$vocabulary)
 {
     parent::ResModel($model);
     $this->vocabulary =& $vocabulary;
 }
 /**
  * tests _node2ResNode()
  */
 function test_node2ResNodeTest()
 {
     $_SESSION['test'] = 'ResModel _node2ResNode test';
     $model1 = new MemModel();
     $resmodel = new ResModel($model1);
     $literal = new Literal('Literal', 'DE');
     $literal->setDatatype('type');
     $result = $resmodel->_node2ResNode($literal);
     $this->assertIsA($result, 'ResLiteral');
     $this->assertEqual($result->getLanguage(), 'DE');
     $this->assertEqual($result->getDatatype(), 'type');
     $model1->close();
 }
 function testFindFirstNullTest()
 {
     $_SESSION['test'] = 'find first match null';
     $model1 = new MemModel();
     $needle = new Statement(new Resource('http://www.example.org/Subject3'), new Resource('http://www.example.org/pred'), new Resource('http://www.example.org/ob'));
     $resSub = new ResResource('http://www.example.org/Subject0');
     $resPred = new ResResource('http://www.example.org/Predicate0');
     $resObj = new ResResource('http://www.example.org/Object0');
     for ($i = -1; $i < 4; $i++) {
         $model1 = $this->_generateModel(100, 2, $i, $needle);
         $resmodel = new ResModel($model1);
         $res = $resmodel->findFirstMatchingStatement(null, null, null);
         $should = $model1->triples[0]->getSubject();
         $sub = $res->getSubject();
         $this->assertEqual($sub->uri, $should->getLabel());
     }
     $model1->close();
 }
 /**
  * Constructor.
  * 
  */
 function __construct()
 {
     parent::__construct();
 }