public function executePublish() { //send the id to the publishing class if (!$this->vocabulary) { $this->vocabulary = VocabularyPeer::retrieveByPK($this->getRequestParameter('id')); } $vocabulary = $this->vocabulary; //todo: these should be configured by the publish form $uselanguageMap = true; $useLanguage = ""; $cLang = null; ini_set('memory_limit', '640M'); ini_set('max_execution_time', 600); $repo = $vocabulary->getRepo(); $mime = "jsonld"; $vocabDir = parse_url($vocabulary->getNamespace(), PHP_URL_PATH); if (!$vocabulary->getRepo() || !$vocabDir) { $this->setFlash('error', 'This Vocabulary has NOT been published. We couldn\'t parse the file names from the uri.</br>Make sure that you\'ve set the the Git repository and have a valid namespace'); $this->redirect($this->getRequest()->getUriPrefix() . '/vocabulary/show/id/' . $vocabulary->getId() . '.html'); } $file = rtrim($vocabDir, "/") . "." . $mime; $repoRoot = SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'repos' . DIRECTORY_SEPARATOR . "agents" . DIRECTORY_SEPARATOR . $vocabulary->getAgentId() . DIRECTORY_SEPARATOR . $repo; $filesystem = new Filesystem(new Adapter($repoRoot), new Cache()); $filePath = $repoRoot . DIRECTORY_SEPARATOR . $mime . DIRECTORY_SEPARATOR . $file; //TODO: create an alias file $aliasPath = "alias" . DIRECTORY_SEPARATOR . $vocabDir; //make sure the path is created $filesystem->put($mime . DIRECTORY_SEPARATOR . $file, ''); //open a file for writing the complete vocabulary file $vocabFile = fopen($filePath, 'w'); $jsonLdService = new jsonldService($vocabulary); fwrite($vocabFile, $jsonLdService->getJsonLd()); fclose($vocabFile); //TODO: generate RDF/XML and save //TODO: generate other flavours of RDF using EasyRDF and save //if publish was successful $this->setFlash('notice', 'This Vocabulary has been published'); $this->redirect($this->getRequest()->getUriPrefix() . '/vocabulary/show/id/' . $vocabulary->getId() . '.html'); }
public function testGetConceptPropertiesArray(FunctionalTester $I) { $concept = ConceptPeer::retrieveByPK(727); $propertyArray = jsonldService::getConceptPropertyArray($concept); $I->assertEquals(json_encode($propertyArray, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), '{ "@id": "http://rdaregistry.info/termList/AspectRatio/1001", "@type": "Concept", "api": "http://api.metadataregistry.org/concepts/727", "inScheme": "http://rdaregistry.info/termList/AspectRatio/", "status": "Published", "prefLabel": { "en": "full screen", "de": "Vollbild", "fr": "plein écran", "es": "pantalla completa", "zh": "全屏" }, "scopeNote": { "en": "Use for standard format, i.e., 1.33:1 or 4:3." }, "definition": { "en": "Aspect ratio for a moving image resource of less than 1.5:1.", "de": "Bildformat einer Bewegtbildressource von weniger als 1.5:1.", "fr": "Format de l’image d’une ressource d’images animées inférieur à 1,5:1.", "es": "Proporción dimensional de un recurso de imagen en movimiento menor que 1.5:1.", "zh": "动态图像资源的宽高比小于1.5:1。" }, "ToolkitLabel": { "en": "full screen", "fr": "plein écran", "de": "Vollbild", "es": "pantalla completa", "zh": "全屏" }, "ToolkitDefinition": { "en": "Aspect ratio for a moving image resource of less than 1.5:1.", "fr": "Format de l’image d’une ressource d’images animées inférieur à 1,5:1.", "de": "Bildformat einer Bewegtbildressource von weniger als 1.5:1.", "es": "Proporción dimensional de un recurso de imagen en movimiento menor que 1.5:1.", "zh": "动态图像资源的宽高比小于1.5:1。" }, "altLabel": { "en": [ "full-screen", "full-screen", "fullscreen", "full-screen" ] } }'); }