As Paolo says. SPARQL INSERT is just an example; the model API works.
You can use models (graphs are just stateless views of the DB) in
transactions.
But you can't use them across transactions.
sConn comes from the StoreConnection manager which also boots any
transaction datasets out of TDBFactory but really it's old API xor
transactions.
Like TDBFactory, StoreConnection manages caching but also transaction
creation.
Andy
On 05/08/11 15:54, Paolo Castagna wrote:
Simon Helsen wrote:
Hi all,
while testing TDB-TX, I noticed that the transaction API as documented in
http://openjena.org/wiki/TDB/Transactions seems to require SPARQL Insert.
At least, it is not clear if write transactions would also work via the
Jena Model APIs.
As far as I understand, the answer is yes. Once you begin a write transaction
you can change data as you prefer. However, I could be wrong and I'd like
Andy to confirm that. :-)
Also, in the API, there is mention of sConn, but it is not clear to me
where that comes from. In the past, I used to create a DataSet using the
TDBFactory.createDataSet(location) method
Documentation can always be improved. In the meantime, use:
Location location = new Location ("/your/path/to/tdb");
StoreConnection sConn = StoreConnection.make(location);
...
You can also look at the current test suite [1], which has examples of how
to do these sort of things.
Paolo
[1]
https://svn.apache.org/repos/asf/incubator/jena/Experimental/TxTDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/
thanks,
Simon