Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sparql query to delete

Tags:

sparql

I am writing a sparql query in java to delete rdf data with a specific id. I am trying with

Delete ?ID ?name Where { 
     ?ID rdf:type ex:example ex:name ?name 
     FILTER(?ID ="something") 
}

but it doesn't do anything. Does anyone knows what is my mistake?

like image 307
user1259487 Avatar asked Mar 14 '12 16:03

user1259487


People also ask

Is SPARQL the same as SQL?

SPARQL and SQL have very similar UNION and MINUS operators, which respectively add and remove solutions from a solution set. Because the datatypes of an SQL table are assumed to be uniform across all rows, care must be taken to align the datatypes of the SELECT.

Which graph update operations can be performed with SPARQL?

SPARQL 1.1 Update supports two categories of update operations on a Graph Store: Graph Update - addition and removal of triples from some graphs within the Graph Store.

What is optional SPARQL?

OPTIONAL is a binary operator that combines two graph patterns. The optional pattern is any group pattern and may involve any SPARQL pattern types. If the group matches, the solution is extended, if not, the original solution is given (q-opt3. rq).

Is SPARQL used?

SPARQL can be used to express queries across diverse data sources, whether the data is stored natively as RDF or viewed as RDF via middleware. SPARQL contains capabilities for querying required and optional graph patterns along with their conjunctions and disjunctions.


1 Answers

That query is probably failing, the closer SPARQL query that might work is ...

DELETE WHERE { 
     ?id rdf:type ex:example;
         ex:name ?name .
     FILTER(?id = <http://foo.com/some/example/uri>) 
}

The var ?id cannot be a string since it is positioned as a subject and in RDF all subjects are IRIs, not literals.

If you post some sample data we might be able to help better.

like image 191
Manuel Salvadores Avatar answered Sep 18 '22 15:09

Manuel Salvadores