fileName = 'data/applications/applications.rdf'; $this->reloadApplications(); } public function reloadApplications() { // Create empty MemModel $factory = new ModelFactory(); $this->model = $factory->getDefaultModel(); if(file_exists($this->fileName)) $this->model->load($this->fileName); } public function readApplicationInfo($applicationID) { $this->reloadApplications(); $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?title ?description ?style WHERE { _application predicates:resource_type resources:application ; predicates:uid "' . $applicationID . '" ; predicates:title ?title ; predicates:description ?description ; predicates:style ?style }'; $result = $this->model->sparqlQuery($querystring); return $result; } public function readAllApplications() { $result = array(); $result[] = $this->readApplicationIDs(); $result[] = $this->readApplicationTitles(); $result[] = $this->readApplicationDescriptions(); $result[] = $this->readApplicationStyles(); return $result; } public function readApplicationIDs() { $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?uid WHERE { _application predicates:resource_type resources:application ; predicates:uid ?uid }'; $result = $this->model->sparqlQuery($querystring); return $result; } public function readApplicationTitles() { $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?title WHERE { _application predicates:resource_type resources:application ; predicates:title ?title }'; $result = $this->model->sparqlQuery($querystring); return $result; } public function readApplicationDescriptions() { $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?description WHERE { _application predicates:resource_type resources:application ; predicates:description ?description }'; $result = $this->model->sparqlQuery($querystring); return $result; } public function readApplicationStyles() { $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?style WHERE { _application predicates:resource_type resources:application ; predicates:style ?style }'; $result = $this->model->sparqlQuery($querystring); return $result; } } ?>