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?
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.
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.
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).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With