Laura Cîrstea
Laura Cîrstea

Reputation: 147

Java how use sparql Delete query

I need some help removing an entry from my fuseki server

For example, how can I remove this entry?

<http://person/Test1>
    <http://purl.org/dc/elements/1.1/name> "Test1" ;

This is what I've tried, but it's not working...

public void deletePerson(String[] personalData ) {
        String personURI    = "http://localhost:3030/Date";
        String name = personalData[0];
        String query = "DELETE WHERE { <http://person/" + formattedName + "> }";
        QueryExecution qe = QueryExecutionFactory.sparqlService(
                "http://localhost:3030/Date/query",
                "PREFIX dc: <http://purl.org/dc/elements/1.1/> " + query);
    }

Exception in thread "AWT-EventQueue-0" com.hp.hpl.jena.query.QueryParseException: Encountered " "DELETE WHERE "" at line 1, column 47. Was expecting one of:
"base" ...
"prefix" ...
"select" ...
"describe" ...
"construct" ...
"ask" ...

Upvotes: 0

Views: 509

Answers (1)

Zineb Errahmouni
Zineb Errahmouni

Reputation: 76

I think you should use UpdateExecutionFactory Something like that

 UpdateRequest request = UpdateFactory.create(queryString) ;
            UpdateProcessor proc = UpdateExecutionFactory.create(request, graphStore) ;

Upvotes: 1

Related Questions