You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Siddharth Trikha <si...@gmail.com> on 2020/05/28 13:57:48 UTC

Remote Transactions using RDF Connection

I have TDB databse which we are thinking of hosting on a Apache Fuseki Server. So my application in Java would connect to the Fuseki server and write code to execute SPARQL queries on the TDB database like:
---------------------------------------------------------------------------------------------------------------------------
RDFConnectionRemoteBuilder builder = RDFConnectionFuseki.create()
            .destination("http://sparql.org/sparql");
        
        Query query = QueryFactory.create("SELECT * { BIND('Hello'as ?text) }");

        // In this variation, a connection is built each time. 
        try ( RDFConnectionFuseki conn = (RDFConnectionFuseki)builder.build() ) { 
            conn.queryResultSet(query, ResultSetFormatter::out);
        }
    }
----------------------------------------------------------------------------------------------------------------------------

According to Jena Specs : https://jena.apache.org/documentation/rdfconnection/

"Remote Transactions:

SPARQL does not define a remote transaction standard protocol. Each remote operation should be atomic (all happens or nothing happens) - this is the responsibility of the remote server.

An RDFConnection will at least provide the client-side locking features. This means that overlapping operations that change data are naturally handled by the transaction pattern within a single JVM."

Does this mean that putting my TDB remotely behind a Fuseki server, I cannot have Transactions support ??

The link above though shows Transactions API. 


Re: Remote Transactions using RDF Connection

Posted by Andy Seaborne <an...@apache.org>.

On 28/05/2020 14:57, Siddharth Trikha wrote:
> I have TDB databse which we are thinking of hosting on a Apache Fuseki Server. So my application in Java would connect to the Fuseki server and write code to execute SPARQL queries on the TDB database like:
> ---------------------------------------------------------------------------------------------------------------------------
> RDFConnectionRemoteBuilder builder = RDFConnectionFuseki.create()
>              .destination("http://sparql.org/sparql");
>          
>          Query query = QueryFactory.create("SELECT * { BIND('Hello'as ?text) }");
> 
>          // In this variation, a connection is built each time.
>          try ( RDFConnectionFuseki conn = (RDFConnectionFuseki)builder.build() ) {
>              conn.queryResultSet(query, ResultSetFormatter::out);
>          }
>      }
> ----------------------------------------------------------------------------------------------------------------------------
> 
> According to Jena Specs : https://jena.apache.org/documentation/rdfconnection/
> 
> "Remote Transactions:
> 
> SPARQL does not define a remote transaction standard protocol. Each remote operation should be atomic (all happens or nothing happens) - this is the responsibility of the remote server.
> 
> An RDFConnection will at least provide the client-side locking features. This means that overlapping operations that change data are naturally handled by the transaction pattern within a single JVM."
> 
> Does this mean that putting my TDB remotely behind a Fuseki server, I cannot have Transactions support ??

Fuseki is always transactional for a single SPARQL operation. For TDB, 
that will be TDB's normal transaction mechanism. For complex setups 
across diferent storage layers and indexes, it is 
multiple-read-OR-single-writer (MRSW locking) which is atomic but not 
allowing TDBstyle multiple readers and a writer at the same time (MR+SW).

What it does not provide is one transaction across multiple requests 
which is what the RDF Connection documentation is referring to.
(something to do sometime, but which opens up a new kind of 
denial-of-service issue - starting a transaction and holding it open).

RDF Connection does provide in the client (so not across different 
connection, maybe different machines) locking that is transactional like 
and will work with any remote SPARQL endpoint, not just Fuseki.

     Andy

> 
> The link above though shows Transactions API.
>