Exemple #1
0
         $tripod = new \Tripod\Mongo\Driver($podName, $storeName, $tripodOptions);
         $contentType = $app->request()->getMediaType();
         switch ($contentType) {
             case 'application/rdf+xml':
                 $format = FORMAT_RDF_XML;
                 break;
             case 'text/plain':
                 $format = FORMAT_NTRIPLES;
                 break;
             case 'text/turtle':
                 $format = FORMAT_TURTLE;
                 break;
             default:
                 $format = FORMAT_RDF_JSON;
         }
         $graph = $tripod->getViewForResource(base64_decode($encodedFqUri), $viewSpecId);
     } while (++$i < READ_REPEAT_NUM);
     if ($graph->is_empty()) {
         $app->response()->setStatus(404);
     } else {
         $output = getFormattedGraph($graph, $format);
         $app->response()->headers()->set('Content-type', getContentType($format));
         echo $output;
     }
 });
 $app->group('/:podName', function () use($app, $tripodOptions) {
     $app->group('/graph', function () use($app, $tripodOptions) {
         $app->get('/:encodedFqUri', function ($storeName, $podName, $encodedFqUri) use($app, $tripodOptions) {
             \Tripod\Mongo\Config::setConfig(json_decode(file_get_contents('./config/tripod-config-' . $storeName . '.json'), true));
             $tripodOptions['statsConfig'] = getStat($app, $tripodOptions);
             $contentType = $app->request()->getMediaType();
 public function testSavingToAPreviouslyEmptyJoinUpdatesView()
 {
     // create a tripod with views sync
     $tripod = new \Tripod\Mongo\Driver("CBD_testing", "tripod_php_testing", array("defaultContext" => "http://talisaspire.com/", "async" => array(OP_VIEWS => false)));
     // should be no triples with "http://basedata.com/b/sequence123" as subject in existing view
     $view = $tripod->getViewForResource("http://basedata.com/b/docWithEmptySeq123", "v_doc_with_seqeunce");
     $this->assertTrue($view->has_triples_about("http://basedata.com/b/docWithEmptySeq123"));
     $this->assertFalse($view->has_triples_about("http://schemas.talis.com/2005/user/schema#xyz"));
     $newGraph = new \Tripod\ExtendedGraph();
     $newGraph->add_literal_triple("http://schemas.talis.com/2005/user/schema#xyz", "http://rdfs.org/sioc/spec/name", "Some name");
     $tripod->saveChanges(new \Tripod\ExtendedGraph(), $newGraph);
     // should be triples with "http://basedata.com/b/sequence123" as subject in new view
     $view = $tripod->getViewForResource("http://basedata.com/b/docWithEmptySeq123", "v_doc_with_seqeunce");
     $this->assertTrue($view->has_triples_about("http://basedata.com/b/docWithEmptySeq123"));
     $this->assertTrue($view->has_triples_about("http://schemas.talis.com/2005/user/schema#xyz"));
 }