trying to understand how to write a sparql servlet that handles read-write 
operations…

I read
- https://jena.apache.org/documentation/notes/concurrency-howto.html
- http://jena.apache.org/documentation/tdb/tdb_transactions.html
(though not working specifically with TDB)
- and 
http://stackoverflow.com/questions/18968971/is-it-possible-to-concurrently-write-to-the-same-dataset-file-but-to-different-n

Not sure to understand everything, correct me if I’m wrong, and TIA if you can 
answer some of these questions:

- if within an application, a model can be updated, then any call to jena (or 
at least, any one that iterates over something) must be inside some kind of 
lock.
- for memory models, including datasets built around memory models, the only 
option is model.enterCriticalSection/leaveCriticalSection
- with TDB, use dataset.begin/dataset.end
- your code must not enter a locking section if you’re already in one. It looks 
that this means that you probably must have some kind of one central, unique 
entry point in your code where you lock/unlock -- hmm, doesn’t seem easy
- in a sparql query over a dataset with memory named graphs, if updates are 
possible, you must lock all the graphs (Dataset.listNames to get the names of 
the graphs, loop over them to enterCriticalSection)
- if a sparql query doens’t include updates, it is better to just take a READ 
lock
- so a big question is: how do you known if a query contains updates or not
- if a sparql query doens’t include updates, is it enough to take a READ lock 
only on the graphs included in the query?
- (necessary only if the answer of previous one is “yes”) you get the graphs in 
a query with the union of getGraphURIs and getNamedGraphURIs” ?

that’s all for the moment, thank you.

Best Regards,

fps

Reply via email to