# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # To run this sample, define these variables first define('USER', "xxx"); # name of your Rambla user account define('PWD', "xxx"); # password of your Rambla user account require_once 'raws_json/json_client.php'; require_once 'raws_json/meta_service.php'; try { $meta = new MetaService(USER, PWD); # create vocab $vocab = $meta->createVocab("myyvocab", "http://myyvocab.org/"); echo "\nCreated vocab: " . $vocab->entry->id . "\n"; # get vocab instance $vocab = $meta->getVocabInstance($vocab->entry->content->params->name); echo "\nRetrieved vocab with namespace: " . $vocab->entry->content->params->xml_namespace . "\n"; # update vocab instance $vocab->entry->content->params->xml_namespace = "http://mynewvocab.com"; $vocab = $meta->updateVocab($vocab); echo "\nUpdated vocab, new namespace = " . $vocab->entry->content->params->xml_namespace . "\n"; # other way to call updateVocab, passing the vocab name as second argument $vocab->entry->content->params->xml_namespace = "http://mynewvocab2.com"; $vocab = $meta->updateVocab($vocab, $vocab->entry->content->params->name); # get all vocab instances echo "\nGetting vocab list..."; $feed = $meta->getVocabList(); foreach ($feed->feed->entry as $e) {
define('LOCAL_PATH', '/path/to/local/file.mp4'); # add path to local (video) file, to be uploaded to the CDN require_once 'raws_json/meta.php'; require_once 'raws_json/json_client.php'; require_once 'raws_json/meta_service.php'; require_once 'raws_json/rass_service.php'; try { $meta = new MetaService(USER, PWD); $rass = new RassService(USER, PWD, RASS_SERVER); # upload files to CDN (RASS PUT item) $item1 = $rass->createItem("/test/content/", "big_buck_bunny.mp4", LOCAL_PATH, True); $item1b = $rass->createItem("/test/content/", "big_buck_bunny.jpg", LOCAL_PATH, True); $item2 = $rass->createItem("/test/content/", "sintel.mp4", LOCAL_PATH, True); # create vocabs if (!$meta->vocabExists("media")) { $meta->createVocab("media", "http://search.yahoo.com/mrss/"); } if (!$meta->vocabExists("myvocab")) { $meta->createVocab("myvocab", "http://myvocab.org/ns/"); } # Create content instance with multiple languages for "/test/content/big_buck_bunny.mp4" $content_obj1 = new MetaContent("big_buck_bunny"); $content_obj1->add_file_obj($item1->entry->content->params->path); $content_obj1->add_file_obj($item1b->entry->content->params->path); $content_obj1->add_meta_obj("title", "media", "Big Buck Bunny", "en"); $content_obj1->add_meta_obj("description", "media", "Big Buck Bunny is a short computer animated film by the Blender Institute, part of the Blender Foundation.", "en"); $content_obj1->add_meta_obj("keywords", "media", "bunny, animation, Blender", "en"); $content_obj1->add_meta_obj("title", "media", "Big Buck Bunny", "nl"); $content_obj1->add_meta_obj("description", "media", "Big Buck Bunny is een animatiefilm gemaakt door het Blender Institute met behulp van opensource software.", "nl"); $content_obj1->add_meta_obj("keywords", "media", "konijn, animatie, Blender", "nl"); $content_obj1->add_meta_obj("tag", "myvocab", "animation", "en");