不允许使用Apache Fuseki HTTP方法SPARQL更新:使用POST错误

I am getting the following error in trying to INSERT DATA into Fuseki by php script:

405: Bad response, 405: Error 405: HTTP method not allowed: SPARQL Update : use POST Fuseki - version 2.3.1 

i m using sparqllib.php library and i have used the same sparql request in the fuseki control panel and it work!

this is my php script:

      $db = sparql_connect( "http://localhost:3030/riimaOnto/update" );

    if(!$db)
    {
        print sparql_errno() . ": " . sparql_error(). "
";
        exit;
    }

    $id = "MyData";

    $sparql = "PREFIX onto:<http://www.semanticweb.org/riima/ontologies/#>
    INSERT DATA 
    {
        onto:$id a onto:Article
    }";



    $result = sparql_query($sparql);

    if (!$result)
    {
        print sparql_errno() . ": " . sparql_error(). " 
";
        exit;
    }

so how can i insert data to my ontology ??

Update is only support by HTTP POST.

The request was sent with HTTP GET. Change operations should never go via GET (the operation maybe cached, POST are not).

In SPARQL query and update are different languages and protocols.

sparql_query presumably does an HTTP GET with ?query=... URL query string.

You need some kind of sparql_update (I don't know sparqllib.php) which uses HTTP POST with the right MIME type and the update in the body. (HTML Form update also works in Fuseki - it will be ?update=...)

if you are using the Apache Jena Fuseki, you should edit the sparql endpoint which by default is "http://localhost:3030/myDataset/query" by clearing off the 'query' and placing 'update' instead