Beispiel #1
0
 /**
  * Test we can SET and GET a URI as object
  *
  */
 public function testSetGetUriObject()
 {
     $uristr = 'http://www.bbc.co.uk:80/';
     $this->_client->setUri('http://www.bbc.co.uk:80/');
     $uri = $this->_client->getUri();
     $this->assertEquals($uristr, $uri);
 }
 /**
  * Test we can SET and GET a URI as object
  *
  */
 public function testSetGetUriObject()
 {
     $uristr = 'http://www.bbc.co.uk:80/';
     $obj = new EasyRdf_Resource($uristr);
     $this->_client->setUri($obj);
     $uri = $this->_client->getUri();
     $this->assertEquals($uristr, $uri);
 }
Beispiel #3
0
 /** Get the data for reuse based off sparql endpoint
  * @access public
  * @return array $data
  * */
 public function getInfo($identifier)
 {
     $key = md5($identifier . 'ocre');
     $uri = self::CRRO . $identifier;
     if (!$this->getCache()->test($key)) {
         EasyRdf_Namespace::set('nm', 'http://nomisma.org/id/');
         EasyRdf_Namespace::set('nmo', 'http://nomisma.org/ontology#');
         EasyRdf_Namespace::set('skos', 'http://www.w3.org/2004/02/skos/core#');
         EasyRdf_Namespace::set('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
         $request = new EasyRdf_Http_Client();
         $request->setUri($uri);
         $response = $request->request()->getStatus();
         if ($response == 200) {
             $graph = new EasyRdf_Graph($uri);
             $graph->load();
             $data = $graph->resource($uri);
             $this->getCache()->save($data);
         } else {
             $data = NULL;
         }
     } else {
         $data = $this->getCache()->load($key);
     }
     return $data;
 }
Beispiel #4
0
 /** Get the data for rendering
  * @access public
  * @return
  * */
 public function getData()
 {
     $key = md5($this->getUri());
     if (!$this->getCache()->test($key)) {
         $request = new EasyRdf_Http_Client();
         $request->setUri($this->getUri());
         $response = $request->request()->getStatus();
         if ($response == 200) {
             $graph = new EasyRdf_Graph($this->_uri);
             $graph->load();
             $data = $graph->resource($this->_uri);
         } else {
             $data = NULL;
         }
         $this->getCache()->save($data);
     } else {
         $data = $this->getCache()->load($key);
     }
     return $data;
 }
Beispiel #5
0
foreach ($manifest->allOfType('test:TestCase') as $test) {
    if (!in_array($RDFA_VERSION, $test->all('rdfatest:rdfaVersion'))) {
        continue;
    }
    if (!in_array($HOST_LANGUAGE, $test->all('rdfatest:hostLanguage'))) {
        continue;
    }
    if ($test->get('test:classification')->shorten() != 'test:required') {
        continue;
    }
    $id = $test->localName();
    $title = $test->get('dc:title');
    $escapedTitle = addcslashes($title, '\'');
    # Download the test input
    $inputUri = "http://rdfa.info/test-suite/test-cases/{$RDFA_VERSION}/{$HOST_LANGUAGE}/{$id}.xhtml";
    $client->setUri("{$inputUri}");
    $response = $client->request();
    file_put_contents("{$FIXTURE_DIR}/{$id}.xhtml", $response->getBody());
    # Download the expected output
    $client->setUri($REFERENCE_DISTILLER . urlencode($inputUri));
    $response = $client->request();
    $lines = array_filter(preg_split("/[\r\n]+/", $response->getBody()));
    if (count($lines)) {
        $data = implode("\n", $lines) . "\n";
    } else {
        $data = '';
    }
    file_put_contents("{$FIXTURE_DIR}/{$id}.nt", $data);
    # Output code for PHPUnit
    print "    public function testCase{$id}()\n";
    print "    {\n";