EasyRDF 0.9.0 and Virtuoso

This code works following SPARQL UPDATE 1.1 $gs = new EasyRdf_Sparql_Client('http://localhost:8890/sparql'); $graph1 = new EasyRdf_Graph(); $graph1->add('http://example.com/test', 'rdfs:label', 'TestAdam'); $graph1->add('http://example.com/test', 'dc:date', time()); $gs->insert($graph1, 'http://library.landportal.info'); This code works following SPARQL 1.1 Graph Store. Take in account that Virtuoso uses an special SPARQL Endpoint $gs = new EasyRdf_GraphStore('http://37.187.148.108:8890/sparql-graph-crud'); $graph1 = new EasyRdf_Graph(); $graph1->add('http://example.com/test', 'rdfs:label', 'TestVale'); $graph1->add('http://example.com/test', 'dc:date', time()); $gs->insert($graph1, 'http://library.landportal.info'); and.. if you want to use SPARUL class EasyRdf_Sparql_Client2 extends EasyRdf_Sparql_Client { public function insert($data, $graphUri = null) { $query = 'INSERT INTO '; if ($graphUri) { $query .= "GRAPH <$graphUri> {"; } $query .= $this->convertToTriples($data); if ($graphUri) { $query .= "}"; } return $this->request('query', $query); } public function clear($graphUri, $silent = false) { $query = "CLEAR"; if ($silent) { $query .= " SILENT"; } if (preg_match('/^all|named|default$/i', $graphUri)) { $query .= " $graphUri"; } else { $query .= " GRAPH <$graphUri>"; } return $this->request('query', $query); } }
Etiquetas