Пример #1
0
# 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) {
        echo "\n* retrieved vocab: " . $e->id . " with namespace = " . $e->content->params->xml_namespace;
    }
    echo "\n... finished retrieving vocab instances.\n";