I have following piece of code to crate triples/graphs in TDB. I need my 
program to work with both local and remote RDFConnection.

        private void testTransaction() {
                
                this.conn.begin( ReadWrite.WRITE );
                try {
                        // Create a sample Model with few triples
                        Model model1 = ModelFactory.createDefaultModel();
                        Resource r1 = model1.createResource( 
"http://example.org/book#1"; );
                        r1.addProperty( DC.title, "SPARQL - the book" );
                        r1.addProperty( DC.description, "A book about SPARQL" );
                        
                        // Create another sample model
                        Model model2 = ModelFactory.createDefaultModel();
                        Resource r2 = model2.createResource( 
"http://example.org/book#2"; );
                        r2.addProperty( DC.title, "Advanced techniques for 
SPARQL" );
                        
                        // Add model1 to the Dataset
                        this.conn.load( "book1", model1 );
                        
                        // Assuming an error condition, abort the transaction
                        this.conn.abort();
                        
                } finally {
                        this.conn.end();
                }
        }


I have noticed following difference in Transactional behavior of Local and 
Remote RDFConnection.
For a RDFConnectionLocal, graph "book1" is not found in the dataset when this 
function is completed
For a RDFConnectionRemote(Fuseki), even if a transaction is aborted, graph 
"book1" gets saved in the dataset and is not rolled back on abort.

My expectation is that, On aborting the transaction, graph "book1" should be 
rolled back from the dataset. 
This is seen in case of local dataset but not working in case of remote dataset.

I have seen examples that are available with jena distribution but they are all 
for local dataset.

Am I missing any concept?
How to implement correct transactional behavior in case of remote dataset?

JK


Reply via email to