On 24/10/13 07:20, Wang Dongsheng wrote:
For a specific named graph, I did this as follow:
---------------------------------------------------------------
Dataset ds = TDBFactory.createDataset("tdb_path");
Model model = ds.getDataset().getNamedModel("specific named graph");
model.removeAll();
//update a new one
Model addNew = FileManager.get().loadModel(" a new owl file.owl ");
model.add(addNew);
-------------------------------------------------------------
After updating, errors happened like this:
java.lang.UnsupportedOperationException: Quad: object cannot be null
com.hp.hpl.jena.sparql.core.Quad.<init>(Quad.java:62)
...
com.hp.hpl.jena.query.ResultSetFormatter.toList(ResultSetFormatter.java:228)
com.wds.util.TDBConnection.htmlQuery(TDBConnection.java:680)
com.wds.sparql.servlet.HtmlPageList.service(HtmlPageList.java:48)
org.apache.jsp.sparql.srch_jsp._jspService(srch_jsp.java:112)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
Two possibilities:
1/ It's a nion-transactional update and you need to sync the dtabase
before exiting the update program. Call TDB.sync(ds) or better, use
transactions.
2/ You are running the update from one JVM and the JSP is running in
another JVM at the same time. Only one program can access a TDB
database at a time - use Fuseki as a database server to mediate shared
access to one database.
Two programs trying to manipulate one set of files is not supported.
Andy