I'm trying to run the sample code from the EasyRDF library with Apache Jena Fuseki, but the following error occurs when entering data into the database:
Fatal error: Uncaught exception 'EasyRdf_Exception' with message 'HTTP request for http:// localhost:3030/test/update?graph=http%3A%2F%2Flocalhost%3A3030%2Ftest%2Ftime.rdf failed: Must be application/sparql-update or application/x-www-form-urlencoded (got application/n-triples)' in D:\Files\xampp\htdocs\test\easyrdf-0.9.0\lib\EasyRdf\GraphStore.php:152 Stack trace: #0 D:\Files\xampp\htdocs\test\easyrdf-0.9.0\lib\EasyRdf\GraphStore.php(217): EasyRdf_GraphStore->sendGraph('POST', Object(EasyRdf_Graph), 'time.rdf', 'ntriples') #1 D:\Files\xampp\htdocs\test\graphstore.php(34): EasyRdf_GraphStore->insert(Object(EasyRdf_Graph), 'time.rdf') #2 {main} thrown in D:\Files\xampp\htdocs\test\easyrdf-0.9.0\lib\EasyRdf\GraphStore.php on line 152
Follow the code:
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/');
require_once "easyrdf-0.9.0/lib/EasyRdf.php";
?>
<html>
<head>
<title>GraphStore example</title>
</head>
<body>
<?php
// Use a local SPARQL 1.1 Graph Store (eg RedStore)
$gs = new EasyRdf_GraphStore('http://localhost:3030/test/update');
// Add the current time in a graph
$graph1 = new EasyRdf_Graph();
$graph1->add('http://example.com/test', 'rdfs:label', 'Test');
$graph1->add('http://example.com/test', 'dc:date', time());
$gs->insert($graph1, 'time.rdf');
// Get the graph back out of the graph store and display it
$graph2 = $gs->get('time.rdf');
print $graph2->dump();
?>
</body>
</html>
Thanks.