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

    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器