They are per storage area.
This blocks and never prints "DONE"
Location loc = Location.create("DB");
Dataset dataset1 = TDBFactory.createDataset(loc);
Dataset dataset2 = TDBFactory.createDataset(loc);
dataset1.begin(ReadWrite.WRITE) ;
dataset2.begin(ReadWrite.WRITE) ;
System.out.println("DONE");
but if either a READ, it will work - there and be many readers and one
writer at a time. The readers will not see the updated by the writer
even after the writer commits.
Creating the datasets is quite cheap. It is not really creating
everything everytime. But a statics works as well; Fuseki uses a static
registry of datasets.
(it's called "connect", "not "create" in TDB2 to make that clearer).
Andy
On 11/09/17 15:57, George News wrote:
Hi all,
I'm facing an issue that I guess it was implemented that way for some
reason. The issue is that I thought that transactions were Dataset
based, not the object but the TDB or whatever database you use.
However while developing my service I have noticed that if you open 2
datasets on the same TDB
Dataset dataset1 = TDBFactory.createDataset(tripleStorePath);
Dataset dataset2 = TDBFactory.createDataset(tripleStorePath);
then each dataset has it's own transaction pointer, that is, read/write
operations are block per object. Is that the expected behaviour? Why is
like this and not blocked per triple store?
Therefore my question now goes in the direction of which is better. I'm
developing a webservice that is working against the same triple store
path. The Dataset object I create on each call is link to the instance
of the class (not static). Then, how should I proceed? Should I create
the Dataset variable as static, so this way I only have one object for all?
Thanks
Regards,