model = $factory->getDefaultModel(); $this->dashboardID = $dashboardID; $this->filePath = 'data/dashboards/'; if (!is_dir($this->filePath)) mkdir($this->filePath); } public function saveDashboard() { $this->model->saveAs($this->filePath.'dashboard_'.$this->dashboardID.'.rdf','rdf'); } public function createDashboard($dTitle, $dDescription, $dCreatorID) { $this->resourceDashboard = new Resource(DASHBOARD.'/'.$this->dashboardID); $resourceDashboardType = new Resource(DASHBOARD); $predicateRType = new Resource(RTYPE); $this->model->add(new Statement($this->resourceDashboard,$predicateRType,$resourceDashboardType)); $literalDashboardID = new Literal($this->dashboardID); $predicateUniqueID = new Resource(UID); $this->model->add(new Statement($this->resourceDashboard,$predicateUniqueID,$literalDashboardID)); $predicateTitle = new Resource(TITLE); $dashboardTitle = new Literal($dTitle); $this->model->add(new Statement($this->resourceDashboard,$predicateTitle,$dashboardTitle)); $predicateDescription = new Resource(DESCRIPTION); $dashboardDescription = new Literal($dDescription); $this->model->add(new Statement($this->resourceDashboard,$predicateDescription,$dashboardDescription)); $predicateCreator = new Resource(CREATOR); $userID = new Literal($dCreatorID); $this->model->add(new Statement($this->resourceDashboard,$predicateCreator,$userID)); } public function addGraph($gID,$gTitle,$gDescription,$gTypes,$gData) { $resourceGraph = new Resource(GRAPH); $predicateTitle = new Resource(TITLE); $graphTitle = new Literal($gTitle); $this->model->add(new Statement($resourceGraph,$predicateTitle,$graphTitle)); $predicateDescription = new Resource(DESCRIPTION); $graphDescription = new Literal($gDescription); $this->model->add(new Statement($resourceGraph,$predicateDescription,$graphDescription)); $predicateUniqueID = new Resource(UID); $graphID = new Literal($gID); $this->model->add(new Statement($resourceQuestion,$predicateUniqueID,$graphID)); $predicateGraphType = new Resource(GRAPH_TYPE); foreach($gTypes as $gType) { $graphType = new Literal($gType); $this->model->add(new Statement($resourceGraph,$predicateGraphType,$gType)); } $predicateData = new Resource(HAS_DATA); foreach($gData as $gThis) { $resourceData = new Resource(DATA); $this->model->add(new Statement($resourceGraph,$predicateData,$resourceData)); $dataType = new Literal($gThis['type']); $predicateDataType = new Resource(DATA_TYPE); $this->model->add(new Statement($resourceData,$predicateDataType,$dataType)); $dataID = new Literal($gThis['id']); $this->model->add(new Statement($resourceData,$predicateUniqueID,$dataID)); } $predicateHasGraph = new Resource(HAS_GRAPH); $this->model->add(new Statement($this->resourceDashboard,$predicateHasGraph,$resourceGraph)); } } ?>