public function testReplaceUris() { $graph = new ExtendedGraph(); $graph->add_literal_triple('http://some/subject/1', 'http://some/predicate', 'some object'); $graph->add_literal_triple('http://some/subject/4', 'http://some/predicate', 'http://some/subject/1'); $graph->add_resource_triple('http://some/subject/2', 'http://some/predicate', 'http://some/subject/1'); $graph->replace_uris('http://some/subject/1', 'http://some/subject/3'); $index = $graph->get_index(); $this->assertFalse($graph->has_triples_about('http://some/subject/1'), "resource with old uri still exists"); $this->assertTrue($graph->has_triples_about('http://some/subject/3'), "resource with new uri doesn't exists"); $this->assertEquals('http://some/subject/3', $index['http://some/subject/2']['http://some/predicate'][0]['value'], "http://some/subject/3"); $this->assertTrue($graph->has_literal_triple('http://some/subject/4', 'http://some/predicate', 'http://some/subject/1'), "literal values should not be replaced"); $graph->replace_uris('http://some/predicate', 'http://some/predicate2'); $index = $graph->get_index(); $this->assertTrue(isset($index['http://some/subject/2']['http://some/predicate2']), "predicate should be replaced"); $this->assertFalse(isset($index['http://some/subject/2']['http://some/predicate']), "predicate should be replaced and old one not be in graph"); }