DELETE QUERY SPARQL FUSEKI

2019-09-13 23:13发布

问题:

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.