/* instantiation */ //creates a special registry-extended store, using a custom ARC2::getStore $store = new Reg_ARC2_Store($arc_config, new stdClass()); if (!$store->isSetup()) { $store->setUp(); } //get the batch log $batchTime = time(); $batchDescription = "Updating 3store - " . $_SERVER['HTTP_HOST'] . ": " . $_SERVER['SERVER_NAME']; $batchLog = new BatchPeer(); //get the vocabularies $foo = new VocabularyPeer(); $selectCriteria = new Criteria(VocabularyPeer::DATABASE_NAME); $rs = $foo->doSelect($selectCriteria); $batchObjectType = "vocabulary"; $result = $batchLog->createBatchRecord($batchTime, $batchDescription, $batchObjectType, "Starting Vocabulary run", "init"); //foreach vocabulary /** @var Vocabulary $vocabulary **/ foreach ($rs as $vocabulary) { $query = 'LOAD <http://' . $_SERVER['HTTP_HOST'] . '/vocabulary/show/id/' . $vocabulary->getId() . '.rdf> INTO <' . $vocabulary->getUri() . '>'; $result = $batchLog->createBatchRecord($batchTime, $batchDescription, $batchObjectType, $query, "query", $vocabulary->getId(), $vocabulary->getUri()); $store->clearErrors(); $rs = $store->query($query); if ($errs = $store->getErrors()) { foreach ($errs as $key => $value) { $result = $batchLog->createBatchRecord($batchTime, $batchDescription, $batchObjectType, $value, "error", $vocabulary->getId(), $vocabulary->getUri()); } } } $result = $batchLog->createBatchRecord($batchTime, $batchDescription, $batchObjectType, "Finish Vocabulary run", "finish"); //get the element sets
public function saveResults($batchId = '') { $batchLog = new \BatchPeer(); if ($batchId) { $criteria = new \Criteria(); $criteria->add(\BatchPeer::ID, $batchId); /** @var $batch \Batch */ $batch = $batchLog::doSelectOne($criteria); } if (empty( $batch )) { $batch = $batchLog->createBatchRecord(time(), "manual import from file", "schema", "manual import (testing)", "import", $this->vocabId, $this->vocabulary->getUri()); } //there's a bunch more stuff we should save here $import = new \FileImportHistory(); $import->setFileName($this->file); $import->setFileType($this->type); //todo $this->mapping isn't correct //$import->setMap($this->mapping); $import->setResults($this->results); $import->setUserId($this->userId); $import->setSchemaId($this->vocabId); $import->setBatch($batch); //$import->setBatch($batch); $import->save(); return $batch->getId(); }