Hello again and thank you both for your replies. At the moment I do not know 
which approach works best I need to modify my code and run more tests. I will 
let you know.
 

----- Original Message -----
From: Stephen Allen <[email protected]>
To: [email protected]
Cc: 
Sent: Tuesday, 5 February 2013, 20:18
Subject: Re: Feed SDBStore with triples retrieved from a remote SPARQL endpoint

On Tue, Feb 5, 2013 at 11:27 AM, Paul Taylor <[email protected]> wrote:
> Hello there,
>
> I would like to know whether I can feed an SDBStore (backed by MySQL) with 
> triples that I get from a remote SPARQL endpoint using a federated SERVICE 
> query without loading the entire ResultSet into memory. A concrete example of 
> what I would like to achieve is the following: ask a SELECT * WHERE {?s ?p 
> ?o} over a remote SPARQL endpoint and store the retrieved triples into a 
> local SDBStore directly not in a ResultSet in memory.
>
> If this is not possible I was thinking to retrieve the triples from the 
> remote SPARQL service in chunks, get the ResultSet in memory, and then add 
> them to the SDBStore, is this reasonable? How do I go about to formulate such 
> a query? Using a OFFSET construct of a SPARQL query? Also, I was thinking 
> whether is possible to get a Model object using a CONSTRUCT query directly 
> into the SDBStore?
>
> Thank you in advance for your valuable help.
>
> Paul

You can do it, but not by using the federated service query.  Instead,
use a direct connection to the remote endpoint (see [1] for more
info).  Both SELECT and CONSTRUCT queries can be totally streaming so
that you never have to hold all of the results in memory at once.  For
CONSTRUCT, you can pass in a Model to add the statements to.

-Stephen

[1] http://jena.apache.org/documentation/query/sparql-remote.html

Reply via email to