简体   繁体   中英

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

I think you should use UpdateExecutionFactory Something like that

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM