public function testGetDescription() { $this->markTestNeedsDatabase(); $this->authenticateDbUser(); $model = Erfurt_App::getInstance()->getSysOntModel(); $resource = new Erfurt_Rdf_Resource('http://ns.ontowiki.net/SysOnt/Anonymous', $model); $description = $resource->getDescription(); $this->assertTrue(isset($description['http://ns.ontowiki.net/SysOnt/Anonymous'])); $anonymousDesc = $description['http://ns.ontowiki.net/SysOnt/Anonymous']; $this->assertTrue(isset($anonymousDesc['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])); $this->assertTrue(isset($anonymousDesc['http://www.w3.org/2000/01/rdf-schema#label'])); $this->assertTrue(isset($anonymousDesc['http://www.w3.org/2000/01/rdf-schema#comment'])); }
/** * forwards to the CKAN registration page with some prefilled values */ public function registerAction() { // this action needs no view $this->_helper->viewRenderer->setNoRender(); // disable layout $this->_helper->layout()->disableLayout(); // m (model) is automatically used and selected if (!isset($this->request->m) && !$this->_owApp->selectedModel) { throw new OntoWiki_Exception('No model pre-selected model and missing parameter m (model)!'); } else { $model = $this->_owApp->selectedModel; } // get model URI / resource and load description $resourceUri = (string) $model; $resource = new Erfurt_Rdf_Resource($resourceUri, $model); $description = $resource->getDescription(); $description = $description[$resourceUri]; // fill CKAN parameter $parameter = array(); $parameter['title'] = $model->getTitle(); $parameter['url'] = $resourceUri; // go through the model info properties and use the first value as // notes value for ckan $infoProperties = $this->_config->descriptionHelper->properties; foreach ($infoProperties as $infoProperty) { if (!isset($parameter['description'])) { if (isset($description[$infoProperty][0]['value'])) { $parameter['notes'] = $description[$infoProperty][0]['value']; } } } // build GET URI from the parameter array to redirect $getparams = '?'; foreach ($parameter as $key => $value) { $getparams .= '&' . $key . '=' . urlencode($value); } $redirectUrl = $this->registerBaseUrl . $getparams; // redirect to CKANs dataset registration page $this->_response->setRedirect($redirectUrl, $code = 302); }