DELETE QUERY SPARQL FUSEKI

假装没事ソ 提交于 2019-12-12 02:15:45

问题


How can I delete all triples statement for a given uri?

My graph contains:

 PREFIX mo: <http://www.dbwic.org/ontology#> 
          PREFIX term:  <http://www.dbwic.org/ontology/terms/>
          PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
 <http://www.dbwic.org/page/d2e2e606-f962-4db1-8ffc-883e75da109a> term:title "tiitle album";
                                                                  term:date "date title";
                                                                  term:name " name ".

I tried to delete all triples for http://www.dbwic.org/page/d2e2e606-f962-4db1-8ffc-883e75da109a but the query is not working.

 PREFIX mo: <http://www.dbwic.org/ontology#> 
          PREFIX term:  <http://www.dbwic.org/ontology/terms/>
          PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
delete{  ?id ?p ?o}
where
    {   
     FILTER (?id = <http://www.dbwic.org/page/d2e2e606-f962-4db1-8ffc-883e75da109a>)
    ?id ?p ?o
    }

SPARQL Query: No 'query=' parameter (#400) Error 400: SPARQL Query: No 'query=' parameter


回答1:


I really can't help with Fuseki, but I wanted to point out that you have a SPARQL anti-pattern here. The where clause does not need a FILTER. I.e. replace

{
   FILTER  (?id = <http://www.dbwic.org/page/d2e2e606-f962-4db1-8ffc-883e75da109a>)
  ?id ?p ?o
}

...with the BGP (Basic Graph Pattern)

{
   <http://www.dbwic.org/page/d2e2e606-f962-4db1-8ffc-883e75da109a> ?p ?o .
}



回答2:


DELETE WHERE { <http://www.dbwic.org/page/d2e2e606-f962-4db1-8ffc-883e75da109a> ?p ?o }

but your problem is this:

SPARQL Query: No 'query=' parameter

It looks like you are sending an update to the query endpoint.

The update and query endpoints are separate.

Check the code used to send the update request. It usually is called "update":

http://host:port/*YourDataset*/update

The query endpoint ends .../query or .../sparql.




回答3:


Make sure you are pointing at the appropriate endpoint. In Fuseki the queries endpoint

for example (http://localhost:3030/mydataset/query) is different than the update endpoint (http://localhost:3030/mydataset/update).

Selects, asks and constructs should be done using the first one, while updates, inserts and deletes should be done using the second one.



来源:https://stackoverflow.com/questions/41620588/delete-query-sparql-fuseki

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!