DevJava
DevJava

Reputation: 39

DELETE QUERY SPARQL FUSEKI

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

Upvotes: 3

Views: 2428

Answers (3)

Yash Khatri
Yash Khatri

Reputation: 57

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.

Upvotes: 1

AndyS
AndyS

Reputation: 16700

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.

Upvotes: 3

scotthenninger
scotthenninger

Reputation: 4001

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 .
}

Upvotes: 2

Related Questions