Exemplo n.º 1
0
 public static function setUpBeforeClass()
 {
     self::$client = new Zend_Http_Client();
     self::$client->SetHeaders(array('Accept' => 'text/html,application/xhtml+xml,application/xml', 'Content-Type' => 'text/xml', 'Accept-Language' => 'nl,en-US,en', 'Accept-Encoding' => 'gzip, deflate', 'Connection' => 'keep-alive'));
     // create a test concept
     $randomn = rand(0, 20480);
     $prefLabel = 'testPrefLable_' . $randomn;
     $notation = 'test-xxx-' . $randomn;
     self::$uuid = uniqid();
     $uuid = uniqid();
     self::$about = BASE_URI_ . "/" . OPENSKOS_SET_code . "/" . $notation;
     $xml = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#">' . '<rdf:Description rdf:about="' . self::$about . '">' . '<skos:prefLabel xml:lang="nl">' . $prefLabel . '</skos:prefLabel>' . '<openskos:uuid>' . $uuid . '</openskos:uuid>' . '<skos:inScheme  rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<openskos:set>' . OPENSKOS_SET_code . '</openskos:set>' . '<openskos:tenant>' . TENANT . '</openskos:tenant>' . '<skos:notation>' . $notation . '</skos:notation>' . '<skos:topConceptOf rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<skos:definition xml:lang="nl">testje (voor def ingevoegd)</skos:definition>' . '</rdf:Description>' . '</rdf:RDF>';
     self::$response0 = RequestResponse::CreateConceptRequest(self::$client, $xml, "false");
     if (self::$response0->getStatus() !== 201) {
         Logging::failureMessaging(self::$response0, "creating test concept");
         return;
     } else {
         // things went well, but when submitting a concept is status is automatically reset to "candidate";
         // now update to change the status for "approved", otherwise autocomplete would not react
         self::$response0 = RequestResponse::UpdateConceptRequest(self::$client, $xml);
         if (self::$response0->getStatus() !== 201) {
             Logging::failureMessaging(self::$response0, "updating test concept to set status to 'apprved'");
             return;
         }
     }
     $randomnC = rand(0, 20480);
     $prefLabelC = 'testPrefLable_' . $randomnC;
     $notationC = 'test-xxx-' . $randomnC;
     self::$uuidC = uniqid();
     self::$aboutC = BASE_URI_ . "/" . OPENSKOS_SET_code . "/" . $notationC;
     $xmlC = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#">' . '<rdf:Description rdf:about="' . self::$aboutC . '">' . '<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>' . '<skos:prefLabel xml:lang="nl">' . $prefLabelC . '</skos:prefLabel>' . '<openskos:set>' . OPENSKOS_SET_code . '</openskos:set>' . '<openskos:uuid>' . self::$uuidC . '</openskos:uuid>' . '<openskos:tenant>' . TENANT . '</openskos:tenant>' . '<skos:notation>' . $notationC . '</skos:notation>' . '<skos:inScheme  rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<skos:topConceptOf rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<skos:definition xml:lang="nl">testje (voor def ingevoegd)</skos:definition>' . '</rdf:Description>' . '</rdf:RDF>';
     self::$response0C = RequestResponse::CreateConceptRequest(self::$client, $xmlC, "false");
 }
Exemplo n.º 2
0
 public static function setUpBeforeClass()
 {
     self::$client = Authenticator::authenticate();
     // create a test concept
     $randomn = rand(0, 2048);
     self::$prefLabel = 'testPrefLable_' . $randomn;
     self::$altLabel = 'testAltLable_' . $randomn;
     self::$hiddenLabel = 'testHiddenLable_' . $randomn;
     self::$notation = 'test-xxx-' . $randomn;
     self::$uuid = uniqid();
     self::$about = BASE_URI_ . CONCEPT_collection . "/" . self::$notation;
     $xml = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#">' . '<rdf:Description rdf:about="' . self::$about . '">' . '<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>' . '<skos:prefLabel xml:lang="nl">' . self::$prefLabel . '</skos:prefLabel>' . '<skos:altLabel xml:lang="nl">' . self::$altLabel . '</skos:altLabel>' . '<skos:hiddenLabel xml:lang="nl">' . self::$hiddenLabel . '</skos:hiddenLabel>' . '<openskos:set rdf:resource="' . BASE_URI_ . CONCEPT_collection . '"/>' . '<openskos:uuid>' . self::$uuid . '</openskos:uuid>' . '<skos:notation>' . self::$notation . '</skos:notation>' . '<skos:inScheme  rdf:resource="http://data.beeldengeluid.nl/gtaa/Onderwerpen"/>' . '<skos:topConceptOf rdf:resource="http://data.beeldengeluid.nl/gtaa/Onderwerpen"/>' . '<skos:definition xml:lang="nl">testje (voor def ingevoegd)</skos:definition>' . '</rdf:Description>' . '</rdf:RDF>';
     self::$response0 = RequestResponse::CreateConceptRequest(self::$client, $xml, "false");
     //var_dump(self::$response0->getBody());
     print "\n Creation status: " . self::$response0->getStatus() . "\n";
 }
Exemplo n.º 3
0
 public static function setUpBeforeClass()
 {
     self::$client = new Zend_Http_Client();
     self::$client->SetHeaders(array('Accept' => 'text/html,application/xhtml+xml,application/xml', 'Content-Type' => 'text/xml', 'Accept-Language' => 'nl,en-US,en', 'Accept-Encoding' => 'gzip, deflate', 'Connection' => 'keep-alive'));
     // create a test concept
     $randomn = rand(0, 2048);
     self::$prefLabel = 'testPrefLable_' . $randomn;
     self::$altLabel = 'testAltLable_' . $randomn;
     self::$hiddenLabel = 'testHiddenLable_' . $randomn;
     self::$notation = 'test-xxx-' . $randomn;
     self::$uuid = uniqid();
     self::$about = BASE_URI_ . "/" . OPENSKOS_SET_code . "/" . self::$notation;
     $xml = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#">' . '<rdf:Description rdf:about="' . self::$about . '">' . '<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>' . '<skos:prefLabel xml:lang="nl">' . self::$prefLabel . '</skos:prefLabel>' . '<skos:altLabel xml:lang="nl">' . self::$altLabel . '</skos:altLabel>' . '<skos:hiddenLabel xml:lang="nl">' . self::$hiddenLabel . '</skos:hiddenLabel>' . '<openskos:set>' . OPENSKOS_SET_code . '</openskos:set>' . '<openskos:tenant>' . TENANT . '</openskos:tenant>' . '<openskos:uuid>' . self::$uuid . '</openskos:uuid>' . '<skos:notation>' . self::$notation . '</skos:notation>' . '<skos:topConceptOf rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<skos:inScheme  rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<skos:definition xml:lang="nl">testje (voor def ingevoegd)</skos:definition>' . '</rdf:Description>' . '</rdf:RDF>';
     self::$response0 = RequestResponse::CreateConceptRequest(self::$client, $xml, "false");
     print "\n Creation status: " . self::$response0->getStatus();
     //var_dump(self::$response0->getBody());
 }
Exemplo n.º 4
0
 public static function setUpBeforeClass()
 {
     self::$client = new Zend_Http_Client();
     self::$client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
     self::$client->SetHeaders(array('Accept' => 'text/html,application/xhtml+xml,application/xml', 'Content-Type' => 'application/json', 'Accept-Language' => 'nl,en-US,en', 'Accept-Encoding' => 'gzip, deflate', 'Connection' => 'keep-alive'));
     self::$abouts = array();
     self::$labelMap = array(PREF_LABEL => PREF_LABEL . "_", ALT_LABEL => ALT_LABEL . "_", HID_LABEL => HID_LABEL . "_", NOTATION => NOTATION . "_");
     // create test concepts
     $letters = range('a', 'z');
     self::$prefs[0] = uniqid();
     $i = 1;
     foreach ($letters as $letter) {
         self::$prefs[$i] = self::$prefs[$i - 1] . $letter;
         $randomn = rand(0, 10000);
         $prefLabel = self::$labelMap[PREF_LABEL] . self::$prefs[$i] . $randomn;
         $altLabel = self::$labelMap[ALT_LABEL] . self::$prefs[$i] . $randomn;
         $hiddenLabel = self::$labelMap[HID_LABEL] . self::$prefs[$i] . $randomn;
         $notation = self::$labelMap[NOTATION] . self::$prefs[$i] . $randomn;
         $uuid = uniqid();
         $about = BASE_URI_ . "/" . OPENSKOS_SET_code . "/" . $notation;
         $xml = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#">' . '<rdf:Description rdf:about="' . $about . '">' . '<skos:prefLabel xml:lang="nl">' . $prefLabel . '</skos:prefLabel>' . '<skos:altLabel xml:lang="nl">' . $altLabel . '</skos:altLabel>' . '<skos:hiddenLabel xml:lang="nl">' . $hiddenLabel . '</skos:hiddenLabel>' . '<openskos:uuid>' . $uuid . '</openskos:uuid>' . '<skos:inScheme  rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<openskos:status>approved</openskos:status>' . '<openskos:set>' . OPENSKOS_SET_code . '</openskos:set>' . '<openskos:tenant>' . TENANT . '</openskos:tenant>' . '<skos:notation>' . $notation . '</skos:notation>' . '<skos:topConceptOf rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<skos:definition xml:lang="nl">testje (voor def ingevoegd)</skos:definition>' . '</rdf:Description>' . '</rdf:RDF>';
         $response0 = RequestResponse::CreateConceptRequest(self::$client, $xml, "false");
         if ($response0->getStatus() !== 201) {
             Logging::failureMessaging($response0, "creating test concept");
             self::$success = false;
             return;
         } else {
             // things went well, but when submitting a concept is status is automatically reset to "candidate";
             // now update to change the status for "approved", otherwise autocomplete would not react
             $response1 = RequestResponse::UpdateConceptRequest(self::$client, $xml);
             if ($response1->getStatus() !== 201) {
                 Logging::failureMessaging($response1, "updating test concept to set status to 'apprved'");
                 self::$success = false;
                 return;
             }
         }
         array_push(self::$abouts, $about);
         $i++;
     }
     self::$success = true;
 }
Exemplo n.º 5
0
 public static function setUpBeforeClass()
 {
     self::$client = new Zend_Http_Client();
     self::$client->SetHeaders(array('Accept' => 'text/html,application/xhtml+xml,application/xml', 'Content-Type' => 'text/xml', 'Accept-Language' => 'nl,en-US,en', 'Accept-Encoding' => 'gzip, deflate', 'Connection' => 'keep-alive'));
     // create a test concept X
     $randomn = rand(0, 2048);
     self::$prefLabelX = 'prefLabelX_' . $randomn;
     self::$notationX = 'test-x-' . $randomn;
     self::$uuidX = uniqid();
     self::$aboutX = BASE_URI_ . CONCEPT_collection . "/" . self::$notationX;
     $xmlX = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#">' . '<rdf:Description rdf:about="' . self::$aboutX . '">' . '<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>' . '<skos:prefLabel xml:lang="nl">' . self::$prefLabelX . '</skos:prefLabel>' . '<openskos:set rdf:resource="' . BASE_URI_ . CONCEPT_collection . '"/>' . '<openskos:uuid>' . self::$uuidX . '</openskos:uuid>' . '<skos:notation>' . self::$notationX . '</skos:notation>' . '<skos:inScheme  rdf:resource="http://data.beeldengeluid.nl/gtaa/Onderwerpen"/>' . '<skos:topConceptOf rdf:resource="http://data.beeldengeluid.nl/gtaa/Onderwerpen"/>' . '<skos:definition xml:lang="nl">testje (voor def ingevoegd)</skos:definition>' . '</rdf:Description>' . '</rdf:RDF>';
     self::$responseX = RequestResponse::CreateConceptRequest(self::$client, $xmlX, "false");
     print "\n Creation status for concept X: " . self::$responseX->getStatus();
     // create a test concept X
     self::$prefLabelY = 'prefLabelY_' . $randomn;
     self::$notationY = 'test-y-' . $randomn;
     self::$uuidY = uniqid();
     self::$aboutY = BASE_URI_ . CONCEPT_collection . "/" . self::$notationY;
     $xmlY = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#">' . '<rdf:Description rdf:about="' . self::$aboutY . '">' . '<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>' . '<skos:prefLabel xml:lang="nl">' . self::$prefLabelY . '</skos:prefLabel>' . '<openskos:set rdf:resource="' . BASE_URI_ . CONCEPT_collection . '"/>' . '<openskos:uuid>' . self::$uuidY . '</openskos:uuid>' . '<skos:notation>' . self::$notationY . '</skos:notation>' . '<skos:inScheme  rdf:resource="http://data.beeldengeluid.nl/gtaa/Onderwerpen"/>' . '<skos:topConceptOf rdf:resource="http://data.beeldengeluid.nl/gtaa/Onderwerpen"/>' . '<skos:definition xml:lang="nl">testje (voor def ingevoegd)</skos:definition>' . '</rdf:Description>' . '</rdf:RDF>';
     self::$responseY = RequestResponse::CreateConceptRequest(self::$client, $xmlY, "false");
     print "\n Creation status for concept X: " . self::$responseY->getStatus();
 }
Exemplo n.º 6
0
 public function test10BCreateConceptWithoutUriButWithoutNotationUniquePrefLabel()
 {
     // Create a concept without Uri (no rdf:about), and no notation. prefLabel is unique.
     print "\n\n test10 ... \n";
     $randomn = rand(0, 4092);
     $uuid = uniqid();
     $prefLabel = 'testPrefLable_' . $randomn;
     $xml = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:openskos="http://openskos.org/xmlns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmi="http://dublincore.org/documents/dcmi-terms/#" > ' . '<rdf:Description>' . '<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>' . '<skos:prefLabel xml:lang="nl">' . $prefLabel . '</skos:prefLabel>' . '<skos:inScheme  rdf:resource="' . SCHEMA_URI_1 . '"/>' . '<openskos:set>' . OPENSKOS_SET_code . '</openskos:set>' . '<openskos:tenant>' . TENANT . '</openskos:tenant>' . '<openskos:uuid>' . $uuid . '</openskos:uuid>' . '</rdf:Description>' . '</rdf:RDF>';
     $response = RequestResponse::CreateConceptRequest($this->client, $xml, "false");
     if ($response->getStatus() == 201) {
         array_push($this->abouts, $this->getAbout($response));
     }
     $this->resultMessaging($response);
     $this->AssertEquals(400, $response->getStatus());
 }