/** * saves a Mashup to the RDF Store * An existing mashup is simply overwritten (remove existing, save a new one) * * @param Mashup $mashup Mashup Object (possibly containing Chunks) * @param array $deletedChunks Array of Chunk objects to be deleted from this Mashup (optional) * @return boolean true if operation was successful */ function saveMashup($mashup, $deletedChunks = array()) { $this->removeMashup($mashup); $mashupRes = new Resource($mashup->getUri()); $this->rdfModel->add(new Statement($mashupRes, RDF::TYPE(), LOOMP::MASHUP())); $this->rdfModel->add(new Statement($mashupRes, DC::CREATOR(), new Resource($mashup->getCreatorId()))); $this->rdfModel->add(new Statement($mashupRes, DC::TITLE(), new Literal($mashup->getTitle()))); $this->rdfModel->add(new Statement($mashupRes, DC::CREATED(), new Literal($mashup->getCreateDate()))); $this->rdfModel->add(new Statement($mashupRes, DC::MODIFIED(), new Literal($mashup->getModifyDate()))); $this->rdfModel->add(new Statement($mashupRes, RDF::TYPE(), RDF::SEQ())); foreach ($mashup->getFragments() as $k => $fragment) { $this->rdfModel->add(new Statement($mashupRes, new Resource(RDF_NAMESPACE_URI . "_" . ($k + 1)), new Resource($fragment->getUri()))); $this->_saveFragment($fragment); } // remove fragments which are not associated with any other mashup foreach ($deletedChunks as $f) { if ($this->_fragmentCount($f->getUri()) == 0) { $this->_removeFragment($f); } } return true; }