SPARQL Update example for updating more than one triple in a single query

前端 未结 4 996
隐瞒了意图╮
隐瞒了意图╮ 2021-01-02 18:11

Can anyone point me to a valid UPDATE statement in SPARQL in any documentation (be it W3C, virtuoso, semantic web page, or your own custom code, etc?

It has

4条回答
  •  梦毁少年i
    2021-01-02 18:56

    Hallelujah thank God.

    After 3 days hitting my head on the wall I believe I have the solution, which is like a work around. First you make the DELETE statement, then you use the semicolon to specify the triples you want to insert. Its still two operations, but at least they are controlled by the query server, i. e. you do not have to perform two separate requests, one for DELETE other for UPDATE (very dangerous).

    Here is my working code, now (apparrently) fixed:

    WITH GRAPH    
    DELETE 
    { 
      :teste  dc:creator  ?o0 .
      :teste  dc:title    ?o1 .
    } 
    WHERE 
    { 
      :teste  dc:creator  ?o0 .
      :teste  dc:title    ?o1 .
    }; 
    

    <------NOTE THE SEMICOLON at the end of the first part

    INSERT DATA
    { 
      :teste   dc:creator   "criador%20do%20teste"  .
      :teste   dc:creator   "second%20criador%20do%20teste"  .
      :teste   dc:creator   "third%20criador%20do%20teste"  .
      :teste   dc:creator   "fourth%20criador%20do%20teste"  .
      :teste   dc:title     "t1"  .
      :teste   dc:title     "t3"  .
      :teste   dc:title     "second%20title"  .
    }
    

提交回复
热议问题