model = $factory->getDefaultModel(); $this->dashboardID = $dashboardID; $this->filePath = 'data/dashboards/dashboard_'.$this->dashboardID.'.rdf'; } public function loadDashboard() { if(file_exists($this->filePath)) { $this->model->load($this->filePath); return true; } else { return false; } } public function getDashboardInfo() { $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?uid ?title ?description ?creator WHERE { _dashboard predicates:resource_type resources:dashboard ; predicates:uid ?uid ; predicates:title ?title ; predicates:description ?description ; predicates:creator ?creator }'; $result = $this->model->sparqlQuery($querystring); return $result; } public function readDashboardGraphs() { $result = array(); $result[] = $this->readSDashboardGraphsTitle(); $result[] = $this->readDashboardGraphsDescription(); return $result; } public function readDashboardGraphsTitle() { $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?graphTitle WHERE { _graph predicates:resource_type resources:graph ; predicates:title ?graphTitle }'; $result = $this->model->sparqlQuery($querystring); return $result; } public function readDashboardGraphsDescription() { $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?graphDescription WHERE { _graph predicates:resource_type resources:graph ; predicates:description ?graphDescription }'; $result = $this->model->sparqlQuery($querystring); return $result; } public function readDashboardGraphsID() { $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?graphID WHERE { _graph predicates:resource_type resources:graph ; predicates:uid ?graphID }'; $result = $this->model->sparqlQuery($querystring); return $result; } public function readGraphTypes($graphID) { $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?type WHERE { _graph predicates:resource_type resources:graph ; predicates:uid "' . $graphID . '" ; predicates:graph_type ?type }'; $result = $this->model->sparqlQuery($querystring); return $result; } public function readGraphData($graphID) { $querystring = ' PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> SELECT ?datatype ?dataid WHERE { _graph predicates:resource_type resources:graph ; predicates:uid "' . $graphID . '" . _data predicates:has_data resources:data ; predicates:data_type ?datatype ; predicates:uid ?dataid }'; $result = $this->model->sparqlQuery($querystring); return $result; } } ?>