Is it generic for any SPARQL endpoint (4store, fuseki, virtuoso, ...)?

On Tue, Nov 27, 2012 at 11:42 PM, Stephen Allen <[email protected]> wrote:
> Also, you can try the experimental "jena-client" project.  It is a
> work-in-progress for interacting with SPARQL endpoints (both local and
> remote).
>
> Instructions for building:
>    svn co https://svn.apache.org/repos/asf/jena/Experimental/jena-client/
> jena-client
>    cd jena-client
>    mvn clean install
>
> Then include "target/jena-client-0.0.8-SNAPSHOT.jar" in your project's
> classpath.  Quick user guide:
>
>    Model m = ... // Your Model with the statements you want to add to
> the remote store
>    Repository repo =
> RepositoryFactory.createRemote("http://localhost:3030/ds/query";,
> "http://localhost:3030/ds/update";);
>    Connection conn = repo.getConnection();
>    try {
>        Updater up = conn.createStreamingUpdater();
>        try {
>            // The first parameter is the named graph to insert the
> Triples into, null == default graph
>            up.insert(null, m.getGraph());
>        }
>        finally {
>            up.close();
>        }
>    }
>    finally {
>        conn.close();
>    }
>
>
> Among the benefits of this:  1) it generates the SPARQL Update request
> for you, and 2) it is fully streaming on the client side, so Model can
> be large (streaming isn't supported on the server yet, see JENA-330).
> 3) A single update request is transactional (a future goal would be
> transactions across remote queries / requests)
>
> If you do use it, or even play around with it for a while, I would
> love to get your feedback.
>
> -Stephen
>
> On Tue, Nov 27, 2012 at 6:16 AM, Andy Seaborne <[email protected]> wrote:
>> On 26/11/12 17:02, Olivier Rossel wrote:
>>>
>>> Hi folks!
>>>
>>> I have a Model full of triples, and I wish I could  "inject" these
>>> data into a remote endpoint. is there a helper class to create a
>>> SPARQL/Insert query from the content of the Model? Otherwise, what is
>>> the best way to create such a query? (Iterating the triples, removing
>>> the blank nodes, appending SPARQL statements to a StringBuffer. And
>>> that's all?
>>
>>
>> DatasetAccessor (which for silly histroical reasons is in Fuseki) may help.
>> It is the GSP protocol for Jena.  You can POST a model.
>>
>> And also no need to mess with bNodes in a INSERT DATA operation.
>>
>>
>>> More advanced question: is it possible to monitor the lifecycle of a
>>> Model (add/remove), and create a SPARQL/Update that mimicks that
>>> lifecycle (to be sent on a remote endpoint)? What is the best way to
>>> do that with Jena? ModelChangedListener (and string appending)?
>>
>>
>> Yes, probably.
>>
>> We have been discussing simplifying this to just have one "add" and one
>> "remove" call.
>>
>>
>>>
>>> Your points of view are highly welcome.
>>>
>>
>>         Andy

Reply via email to