On 08/06/12 09:30, Don S wrote:
HI,
Finally I succeed to call the
function UpdateExecutionFactory.createRemote. Thanks for the comments.
Here is my configuration
Fuseki server
java -Xmx1200M -jar fuseki-server.jar --update --mem
--loc=D:/fuseki-0.2.2/TD /ds2
and the insert query code
public class search {
static final String inputFileName = "http://localhost:3030/";
public static void main(String[] args) throws IOException{
Model model =ModelFactory.createOntologyModel();
// use the FileManager to find the input file
InputStream in = FileManager.get().open(inputFileName);
if (in == null) {
throw new IllegalArgumentException( "File: " + inputFileName +
" not found");
}
model.read(inputFileName+"per2.owl");
in.close();
What's in model at this point?
String queryString ="PREFIX xmlns:
<http://localhost:3030/per1.owl#>\r\n"
+
"PREFIX base:<http://localhost:3030/per1.owl
\r"+
"PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\r"+
"INSERT DATA" +
"{"+
"<http://localhost:3030/per1.owl#name1>\n" +
"xmlns:hasFirstname \"Rex\"^^ xsd:string;" +
"}";
xmlns is not a good choice of prefix name.
GraphStore gs=GraphStoreFactory.create(model);
gs.setDefaultGraph(model.getGraph());
UpdateRequest ur = UpdateFactory.create(queryString);
Update update = ur.getOperations().get(0);
UpdateExecutionFactory.createRemote(ur,"
http://localhost:3030/per2.owl");
UpdateAction.execute(ur,gs);
System.out.println(update);
// some codes ....
qe.close();
}
}
I am wondering why it is not updating the ontology??
regards
What does the Fuseki log say?
UpdateExecutionFactory.createRemote(ur,"http://localhost:3030/per2.owl");
per2.owl is not a SPARQL update service endpoint.
http://localhost:3030/ds2/update is the SPARQL update service endpoint.
Andy