Exemplo n.º 1
0
 /**
  * Loop trough the jena infmodel tests
  */
 function testRdfsFModel()
 {
     $testURI = 'http://www.hpl.hp.com/semweb/2003/query_tester#';
     $testmodel = new MemModel($testURI);
     $testmodel->load(RDFS_INF_TESTFILES . 'rdfs/manifest-standard.rdf');
     $i = 1;
     do {
         $inf = new RDFSFModel();
         $res1 = $testmodel->find(new Resource(RDFS_INF_TESTFILES . 'rdfs/test' . $i++), null, null);
         if ($res1->isEmpty()) {
             break;
         }
         $findTBOX = $res1->find(null, new Resource($testURI . 'tbox'), null);
         $inf->load(RDFS_INF_TESTFILES . $findTBOX->triples[0]->getLabelObject());
         $findDATA = $res1->find(null, new Resource($testURI . 'data'), null);
         $inf->load(RDFS_INF_TESTFILES . $findDATA->triples[0]->getLabelObject());
         $findQUERY = $res1->find(null, new Resource($testURI . 'query'), null);
         $query = $this->_doFindFromFile(RDFS_INF_TESTFILES . $findQUERY->triples[0]->getLabelObject(), $inf);
         $result = new MemModel();
         $findRESULT = $res1->find(null, new Resource($testURI . 'result'), null);
         $result->load(RDFS_INF_TESTFILES . $findRESULT->triples[0]->getLabelObject());
         $isEqual = $result->equals($query);
         #$query->writeAsHtmlTable();
         #$result->writeAsHtmlTable();
         #$subtract=$query->subtract($result);
         #$subtract->writeAsHtmlTable();
         $findDATA = $res1->find(null, new Resource($testURI . 'description'), null);
         echo '<b>' . $findDATA->triples[0]->getLabelObject() . ' (RDFSFModel)</b><BR>';
         $this->assertTrue($isEqual);
     } while (true);
 }
Exemplo n.º 2
0
 function testRdfParser()
 {
     $_SESSION['test'] = 'Rdf- Parser Empty Resource test';
     $mod1 = new MemModel();
     $mod2 = new MemModel();
     $mod1->load('emptyResource.rdf');
     $mod2->load('emptyResource_serialized.rdf');
     if ($mod1->equals($mod2)) {
         $pass = true;
     } else {
         $pass = false;
     }
     $this->assertTrue($pass);
 }
Exemplo n.º 3
0
 function testIsEquals()
 {
     foreach ($_SESSION['rdf_positive_tests'] as $key => $value) {
         $model1 = new MemModel();
         $model2 = new MemModel();
         $file = $value;
         $_SESSION['test'] =& $value;
         $_SESSION['key'] =& $key;
         $model1->load(TESTCASES_DIR . $file . ".rdf");
         $_SESSION['mod1'] = $model1;
         $model2->load(TESTCASES_DIR . $file . ".nt");
         $_SESSION['mod2'] = $model2;
         $this->assertTrue($model1->equals($model2));
     }
 }
Exemplo n.º 4
0
 function testRdfSerializer()
 {
     $_SESSION['test'] = 'Rdf- Parser Empty Resource test';
     $mod1 = new MemModel();
     $mod2 = new MemModel();
     $mod3 = new MemModel();
     $mod1->load('multipleTypes.rdf');
     $mod1->saveAs('mt1.rdf', 'rdf');
     $mod3->load('mt1.rdf');
     $mod2->load('multipleTypes.rdf');
     $_SESSION['mod1'] = $mod3;
     $_SESSIOn['mod2'] = $mod2;
     if ($mod3->equals($mod2)) {
         $pass = true;
     } else {
         $pass = false;
     }
     $this->assertTrue($pass);
 }