function testGetModelByRDQL3() { if (isset($model2)) { } unset($model2); $_SESSION['test'] = 'simple rdql query3'; $model = new MemModel(); $model->load('employees.rdf'); $query = ' SELECT ?x WHERE (?x,<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://www.w3.org/2001/vcard-rdf/3.0#work>)'; $model2 = $model->getMemModelByRDQL($query); $this->assertEqual($model2->size(), 6); $model3 = $model2->find(null, RDF::TYPE(), new Resource('http://www.w3.org/2001/vcard-rdf/3.0#work')); $this->assertEqual(6, $model3->size()); }
private function _getAnnotations(&$m, $lang) { $ann = array(); $it = $m->findAsIterator(NULL, RDF::TYPE(), LOOMP::ANNOTATION()); while ($it->hasNext()) { $s = $it->next()->getSubject(); $uri = $this->_getPropValue($m, $s, LOOMP::REFERS_TO()); $label = $this->_getLiteralInLang($m->find($s, RDFS::LABEL(), NULL), $lang); $description = $this->_getLiteralInLang($m->find($s, RDFS::COMMENT(), NULL), $lang); $type = $this->_getPropValue($m, $s, LOOMP::ANNOTATION_TYPE()); $annDomain = $this->_getPropValue($m, $s, LOOMP::ANNOTATION_DOMAIN()); if ($annDomain == '') { $annDomain = RDF::RESOURCE()->getURI(); } $annRange = $this->_getPropValue($m, $s, LOOMP::ANNOTATION_RANGE()); $ann[] = new Annotation($uri, $label, $description, $type, $annDomain, $annRange); } return $ann; }