private function getAbout($response) { $dom = new Zend_Dom_Query(); $namespaces = RequestResponse::setNamespaces(); $dom->setDocumentXML($response->getBody()); $dom->registerXpathNamespaces($namespaces); $description = $dom->queryXpath('/rdf:RDF/rdf:Description'); $this->assertEquals(1, $description->count(), "rdf:Description element is not declared"); $resURI = $description->current()->getAttribute("rdf:about"); $this->assertNotEquals("", $resURI, "No valid uri for SKOS concept"); return $resURI; }
public function testImport() { print "\n" . "Testing import ... "; $response = RequestResponse::ImportConceptRequest(self::$client, self::$postData, self::$boundaryNumeric); Logging::var_error_log("\n Response body ", $response->getBody(), __DIR__ . "/ImportResponse.html"); $this->AssertEquals(200, $response->getStatus(), 'Failed to import concept'); $output = array('0' => "The ouput of sending jobs: "); $retvar = 0; $sendjob = exec(PHP_JOBS_PROCESS, $output, $retvar); // check via spraql query //$sparqlResult = $this ->sparqlRetrieveTriplesForNotation(self::$notation); //var_dump($sparqlResult); self::$client->setUri(BASE_URI_ . '/public/api/find-concepts?q=prefLabel:' . self::$prefLabel); $responseGet = self::$client->request(Zend_Http_Client::GET); $this->AssertEquals(200, $responseGet->getStatus(), $responseGet->getMessage()); $dom = new Zend_Dom_Query(); $namespaces = RequestResponse::setNamespaces(); $dom->registerXpathNamespaces($namespaces); $xml = $responseGet->getBody(); $dom->setDocumentXML($xml); var_dump($xml); $results1 = $dom->query('rdf:RDF'); $this->AssertEquals(1, $results1->current()->getAttribute('openskos:numFound')); $results2 = $dom->queryXpath('/rdf:RDF/rdf:Description'); $this->AssertEquals(1, count($results2)); }
private function assertionsForXMLRDFConcept($response, $prefLabel, $altLabel, $hiddenLabel, $lang, $definition, $notation, $topConceptOf, $inScheme) { $dom = new Zend_Dom_Query(); $namespaces = RequestResponse::setNamespaces(); $dom->registerXpathNamespaces($namespaces); $xml = $response->getBody(); $dom->setDocumentXML($xml); $results1 = $dom->queryXpath('/rdf:RDF/rdf:Description'); $this->AssertEquals(1, count($results1)); $this->AssertStringStartsWith(BASE_URI_ . "/" . OPENSKOS_SET_code, $results1->current()->getAttribute('rdf:about')); $results2 = $dom->query('rdf:type'); $this->AssertEquals(CONCEPT_type, $results2->current()->getAttribute('rdf:resource')); $results3 = $dom->query('skos:notation'); $this->AssertEquals($notation, $results3->current()->nodeValue); $results4 = $dom->query('skos:inScheme'); $this->AssertEquals($inScheme, count($results4)); $results5 = $dom->query('skos:topConceptOf'); $this->AssertEquals($topConceptOf, count($results5)); $results6 = $dom->query('skos:prefLabel'); $this->AssertEquals($lang, $results6->current()->getAttribute('xml:lang')); $this->AssertEquals($prefLabel, $results6->current()->nodeValue); $results6a = $dom->query('skos:altLabel'); $this->AssertEquals($lang, $results6a->current()->getAttribute('xml:lang')); $this->AssertEquals($altLabel, $results6a->current()->nodeValue); $results6b = $dom->query('skos:hiddenLabel'); $this->AssertEquals($lang, $results6b->current()->getAttribute('xml:lang')); $this->AssertEquals($hiddenLabel, $results6b->current()->nodeValue); $results7 = $dom->query('skos:definition'); $this->AssertEquals($definition, $results7->current()->nodeValue); $results9 = $dom->query('dcterms:creator'); $this->AssertStringStartsWith(BASE_URI_, $results9->current()->getAttribute('rdf:resource')); $results8 = $dom->query('openskos:set'); $this->AssertEquals(OPENSKOS_SET_code, $results8->current()->nodeValue); }