On 12/08/16 20:37,
opavl...@gmail.com wrote:
> In my project I've faced with a problem. The problem is that I have very a lot
> of the big queries that encoded like strings. I'd like to find tools that gets
> more easy way to work with sparql queries and data. I think the Alibaba project
> is a good tool to map rdf data to java objects.
> I'd like to ask, do you know any opensource projects that work with big amount
> of sparql queries and what is the best practice to work with them in java projects?
There's several ways to "handle" large queries. The obvious ones are just about
using good coding practices:
1) create each query in a single place and encapsulate it properly;
2) use Stringbuilders to construct the string instead of just simple string
concatenation;
3) wherever possible reuse PreparedQuery objects (setting specific values with
setBinding()).
Other tools: for creating SPARQL queries in code, RDF4J has a fluent
QueryBuilder API.
ParsedTupleQuery query = QueryBuilderFactory
.select("x", "y")
.group()
.atom("x", RDF.TYPE, "y")
.closeGroup()
.query();
I must admit it's in beta, underdocumented, and currenly lacking several SPARQL
1.1 features, but it's still useful for many purposes. Extending and improving
it is high on our priority list for the next major RDF4J release by the way.
If you are specifically looking for RDF-to-OO mapping tools then Pinto
(
https://github.com/Complexible/pinto) is worth taking a look at. It's a very
lightweight framework for mapping bean classes to/from RDF using the RDF4J APIs.
Jeen