douzong6649 2016-05-13 21:41
浏览 171

不允许使用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 ??

  • 写回答

2条回答 默认 最新

  • doumou8527 2016-05-14 09:10
    关注

    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=...)

    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的