简体   繁体   中英

Jena Fuseki Sparlql INSERT and DELETE in java

I am using the apache jena sparql api to communicate with a remote jena fuseki server using the uri as in the uri: http://localhost:3030/Test . I would like to preform sparql insert and delete queries in addition to select. Here is my code for select queries:

private String serviceURI =  "http://localhost:3030/Test";
    /**
     * This method prints the result of a sparql query as table
     * @param Query to get the result of
     */
    public void printSparqlResult(String query){
        QueryExecution q = QueryExecutionFactory.sparqlService(this.serviceURI,query);
        ResultSet results = q.execSelect(); // get result-set
         ResultSetFormatter.out(System.out, results); // print results
    }

SPARQL Query and SPARQL Update are different languages

Use UpdateExecutionFactory to create an execution of a SPARQL Update.

The endpoint will not be " http://localhost:3030/Test " -- more likely " http://localhost:3030/Test/update ". The query service is /Test/query though directly on the dataset usually works.

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