You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Martynas Jusevičius <ma...@graphity.org> on 2015/12/15 13:27:51 UTC

Jersey Client for HTTP I/O

Hey all,

I refactored HTTP I/O code which previously combined Jena's
DataManager, DatasetGraphAccessorHTTP, and QueryEngineHTTP using
Jersey Client 1.x API.

I think the code became much more higher-level, flexible and
consistent. ClientResponse provides a rich interface with full
metadata about the response. The serialization logic is orthogonal to
HTTP and is separated nicely into JAX-RS MessageBodyReaders/Writers.
JAX-RS 2.x provides even more features.

I'd like to suggest that Jena 3 evaluates both JAX-RS and Client API
as dependencies instead of Apache HTTPClient.

Refactored DataManager.loadModel():
https://github.com/Graphity/graphity-core/blob/de8d9c201ea95ec5f8978052697a515c747137b1/src/main/java/org/graphity/core/util/jena/DataManager.java#L130

SPARQL and GSP clients:
https://github.com/Graphity/graphity-core/blob/de8d9c201ea95ec5f8978052697a515c747137b1/src/main/java/org/graphity/core/client/SPARQLClient.java
https://github.com/Graphity/graphity-core/blob/de8d9c201ea95ec5f8978052697a515c747137b1/src/main/java/org/graphity/core/client/GraphStoreClient.java

Model provider:
https://github.com/Graphity/graphity-core/blob/de8d9c201ea95ec5f8978052697a515c747137b1/src/main/java/org/graphity/core/provider/ModelProvider.java


Martynas
graphityhq.com

Re: Jersey Client for HTTP I/O

Posted by Andy Seaborne <an...@apache.org>.
On 15/12/15 12:27, Martynas Jusevičius wrote:
> Hey all,
>
> I refactored HTTP I/O code which previously combined Jena's
> DataManager, DatasetGraphAccessorHTTP, and QueryEngineHTTP using
> Jersey Client 1.x API.
>
> I think the code became much more higher-level, flexible and
> consistent. ClientResponse provides a rich interface with full
> metadata about the response. The serialization logic is orthogonal to
> HTTP and is separated nicely into JAX-RS MessageBodyReaders/Writers.
> JAX-RS 2.x provides even more features.
>
> I'd like to suggest that Jena 3 evaluates both JAX-RS and Client API
> as dependencies instead of Apache HTTPClient.
>
> Refactored DataManager.loadModel():
> https://github.com/Graphity/graphity-core/blob/de8d9c201ea95ec5f8978052697a515c747137b1/src/main/java/org/graphity/core/util/jena/DataManager.java#L130
>
> SPARQL and GSP clients:
> https://github.com/Graphity/graphity-core/blob/de8d9c201ea95ec5f8978052697a515c747137b1/src/main/java/org/graphity/core/client/SPARQLClient.java
> https://github.com/Graphity/graphity-core/blob/de8d9c201ea95ec5f8978052697a515c747137b1/src/main/java/org/graphity/core/client/GraphStoreClient.java
>
> Model provider:
> https://github.com/Graphity/graphity-core/blob/de8d9c201ea95ec5f8978052697a515c747137b1/src/main/java/org/graphity/core/provider/ModelProvider.java
>
>
> Martynas
> graphityhq.com
>

Hi Martynas,

The Jersey Client API is quite nice. The Jena APIs aim to be one step 
removed, so that they work in terms of RDF concepts rather than the 
network details.

What effect does this have on the application and application writer? 
When I go to those links, I then have to go to a lot more graphity code 
so it looks to me like a new API.  (e.g. GraphStoreClient.getModel does 
not actually get a model - it returns an HTTP response that the caller 
then needs to do something with).

Having different APIs with different styles even if covering the same 
functionality is no bad thing.  In fact, it does not even have to be 
part of jena itself - I would hope that new ideas can be published 
without the project being a bottleneck.  Then a group of adventurous 
people can work to create something that works for them.

There has been a discussion about a new API.  I combined several set of 
ideas that there were into:

https://github.com/afs/jena-rdfconnection/

which brings all the SPARQL operations into one place making it more 
familiar and works local or remote.

Would your ideas fit as an implementation of that interface?

	Andy

PS FileManager is effective subsumed by RDFDataMgr.