public function testListNamedGraphsWithLimit() { $this->client->addMock('GET', '/sparql?query=SELECT+DISTINCT+%3Fg+WHERE+%7BGRAPH+%3Fg+%7B%3Fs+%3Fp+%3Fo%7D%7D+LIMIT+10', readFixture('sparql_select_named_graphs.json'), array('headers' => array('Content-Type' => 'application/sparql-results+json; charset=utf-8'))); $list = $this->sparql->listNamedGraphs(10); $this->assertCount(3, $list); $this->assertEquals(new EasyRdf_Resource('http://example.org/0'), $list[0]); $this->assertEquals(new EasyRdf_Resource('http://example.org/1'), $list[1]); $this->assertEquals(new EasyRdf_Resource('http://example.org/2'), $list[2]); }
</head> <body> <h1>EasyRdf Basic Sparql Example</h1> <?php print "Count: " . $sparql->countTriples() . "<br />\n"; $result = $sparql->clear('all'); print "Result: " . $result->getMessage() . "<br />\n"; $graph = new EasyRdf_Graph(); $person = $graph->resource('http://example.com/joe', 'foaf:Person'); $person->add('foaf:name', 'Joe'); $result = $sparql->insert($graph, 'http://example.com/joe'); $result = $sparql->insert('<s> <p> <o>', 'http://example.org/1'); print "Result: " . $result->getMessage() . "<br />\n"; $result = $sparql->insert('<s> <p> <o>', 'http://example.org/2'); print "Result: " . $result->getMessage() . "<br />\n"; $result = $sparql->insert('<s> <p> <o>', 'http://example.org/2'); print "Result: " . $result->getMessage() . "<br />\n"; // $result = $sparql->load('http://www.dajobe.org/foaf.rdf'); // print "Result: ".$result->getMessage()."<br />\n"; print "Count: " . $sparql->countTriples() . "<br />\n"; print "<ul>\n"; foreach ($sparql->listNamedGraphs(10) as $uri) { print "<li>{$uri}</li>\n"; } print "</ul>\n"; ?> </body> </html>