A collection of Jena-extensions for hiding SPARQL-complexity from the application layer
Switch branches/tags
v3.7.0-3 v3.7.0-2 v3.7.0-1 v3.6.0-3 v3.6.0-2 v3.6.0-1 v3.5.0-3 v3.3.0-2 v3.3.0-1 jena-sparql-api-parent-3.5.0-2 jena-sparql-api-parent-3.5.0-1 jena-sparql-api-parent-3.4.0-1 jena-sparql-api-parent-3.3.0-3 jena-sparql-api-parent-3.1.0-1 jena-sparql-api-parent-3.0.1-1 jena-sparql-api-parent-2.13.0-6 jena-sparql-api-parent-2.13.0-5 jena-sparql-api-parent-2.13.0-4 jena-sparql-api-parent-2.13.0-3 jena-sparql-api-parent-2.13.0-2 jena-sparql-api-parent-2.13.0-1 jena-sparql-api-parent-2.12.1-9 jena-sparql-api-parent-2.12.1-8 jena-sparql-api-parent-2.12.1-7 jena-sparql-api-parent-2.12.1-6 jena-sparql-api-parent-2.12.1-5 jena-sparql-api-parent-2.12.1-4 jena-sparql-api-parent-2.12.1-3 jena-sparql-api-parent-2.12.1-2 jena-sparql-api-parent-2.12.1-1 jena-sparql-api-parent-2.11.2-59 jena-sparql-api-parent-2.11.2-58 jena-sparql-api-parent-2.11.2-57 jena-sparql-api-parent-2.11.2-56 jena-sparql-api-parent-2.11.2-55 jena-sparql-api-parent-2.11.2-54 jena-sparql-api-parent-2.11.2-53 jena-sparql-api-parent-2.11.2-52 jena-sparql-api-parent-2.11.2-51 jena-sparql-api-parent-2.11.2-50 jena-sparql-api-parent-2.11.1-49 jena-sparql-api-parent-2.11.1-48 jena-sparql-api-parent-2.11.1-47 jena-sparql-api-parent-2.11.1-46 jena-sparql-api-parent-2.11.1-45 jena-sparql-api-parent-2.11.1-44 jena-sparql-api-parent-2.10.0-43 jena-sparql-api-parent-2.10.0-42 jena-sparql-api-parent-2.10.0-41 jena-sparql-api-parent-2.10.0-40 jena-sparql-api-parent-2.10.0-39 jena-sparql-api-parent-2.10.0-38 jena-sparql-api-parent-2.10.0-37 jena-sparql-api-parent-2.10.0-36 jena-sparql-api-parent-2.10.0-35 jena-sparql-api-parent-2.10.0-34 jena-sparql-api-parent-2.10.0-33 jena-sparql-api-parent-2.10.0-32 jena-sparql-api-parent-2.10.0-31 jena-sparql-api-parent-2.10.0-30 jena-sparql-api-parent-2.10.0-29 jena-sparql-api-parent-2.10.0-28 jena-sparql-api-parent-2.10.0-27 jena-sparql-api-parent-2.10.0-26 jena-sparql-api-parent-2.10.0-25 jena-sparql-api-parent-2.10.0-24 jena-sparql-api-parent-2.10.0-23 jena-sparql-api-parent-2.10.0-22 jena-sparql-api-parent-2.10.0-21 jena-sparql-api-parent-2.10.0-20 jena-sparql-api-parent-2.10.0-19 jena-sparql-api-parent-2.10.0-18 jena-sparql-api-parent-2.10.0-17 jena-sparql-api-parent-2.10.0-16 jena-sparql-api-parent-2.10.0-15 jena-sparql-api-parent-2.10.0-14 jena-sparql-api-parent-2.10.0-13 jena-sparql-api-parent-2.10.0-12 jena-sparql-api-parent-2.10.0-11 jena-sparql-api-parent-2.10.0-10 jena-sparql-api-parent-2.10.0-9 jena-sparql-api-parent-2.10.0-8 jena-sparql-api-parent-2.10.0-7 jena-sparql-api-parent-2.10.0-6 jena-sparql-api-parent-2.10.0-5 jena-sparql-api-parent-2.10.0-4 jena-sparql-api-parent-2.10.0-3 jena-sparql-api-parent-2.10.0-2 jena-sparql-api-parent-2.10.0-1
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
benchmarking Merge branch 'release/3.6.0-3' May 13, 2018
jena-sparql-api-cache update versions for release Jun 25, 2018
jena-sparql-api-data-client update versions for release Jun 25, 2018
jena-sparql-api-example-proxy update versions for release Jun 25, 2018
jena-sparql-api-geo update versions for release Jun 25, 2018
jena-sparql-api-query-containment update versions for release Jun 25, 2018
jena-sparql-api-update update versions for release Jun 25, 2018
jena-sparql-api-virtuoso update versions for release Jun 25, 2018
TODOs.txt project compiling, but several query containment test cases broke - l… Sep 11, 2017


Welcome to the Jena SPARQL API project

An advanced Jena-based SPARQL processing stack for building Semantic Web applications.


  • Fluent SPARQL Query API - Transparently enhance query execution with caching, pagination, rewriting, transformations, and so on, without having to worry about that in your application logic.
  • Transparent basic (normalized) string caching - Just the usual string based caching as it has been implemented over and over again
  • Query Transformations
  • SPARQL sub graph isomorphism checker
  • Transparent sub graph isomorphy cache - Uses the isomorphism checker for caching - Detects whether prior result sets fit into a current query - regardless of variable naming.
  • JPA-based Java<->RDF mapper: Run JPA criteria queries over Java classes which are actually backed by SPARQL.

Build Status

This library offers several Jena-compatible ways to transparently add delays, caching, pagination, retry and even query transformations before sending off your original SPARQL query. This frees your application layer from the hassle of dealing with those issues. Also, the server module bundles Jena with the Atmosphere framework, giving you a kickstart for REST and websocket implementations.


Releases are available on maven central. Snapshots are presently published in our own archiva:

	    <name>University Leipzig, AKSW Maven2 Repository</name>

        <!-- This is the core artifact; several other ones build on that. -->
		<version>{check available versions with the link below}</version>

Latest version(s): jena-sparql-api on maven central

Project structure

This library is composed of the following modules:

  • jena-sparql-api-core: Contains the core interfaces and basic implementations.
  • jena-sparql-api-server: An abstract SPARQL enpdoint class that allows you to easily create your own SPARQL endpoint. For example, the SPARQL-SQL rewriter Sparqlify is implemented against these interfaces.
  • jena-sparql-api-utils: Utilities common to all packages.
  • jena-sparql-api-example-proxy: An example how to create a simple SPARQL proxy. You can easily adapt it to add pagination, caching and delays.
  • jena-sparql-api-sparql-ext: SPARQL extensions for processing non-RDF data as part of query evaluation. Most prominently features support for querying JSON documents and unnesting JSON arrays to triples. (We should also add CSV processing for completeness, although covered by the TARQL tool).
  • jena-sparql-api-jgrapht: Provides a JGraphT wrapper for Jena's Graph interface. Yes, we were aware that RDF is not a plain graph, but a labeled directed pseudo graph and implemented it accordingly. Also contains conversions of SPARQL queries to graphs. Enables e.g. subgraph isomorphism analysis.
  • jena-sparql-api-mapper: Powerful module to query RDF data transparently with the Java Persistence API (JPA) criteria queries. I.e. queries and updates are expressed over (annotated) Java classes, and no RDF specifics are exposed to the developer.


Here is a brief summary of what you can do. A complete example is avaible here.

Http Query Execution Factory

QueryExecutionFactory qef = new QueryExecutionFactoryHttp("http://dbpedia.org/sparql", "http://dbpedia.org");

Adding a 2000 millisecond delay in order to be nice to the backend

qef = new QueryExecutionFactoryDelay(qef, 2000);

Set up a cache

// Some boilerplace code which may get simpler soon
long timeToLive = 24l * 60l * 60l * 1000l; 
CacheCoreEx cacheBackend = CacheCoreH2.create("sparql", timeToLive, true);
CacheEx cacheFrontend = new CacheExImpl(cacheBackend);

qef = new QueryExecutionFactoryCacheEx(qef, cacheFrontend);

Add pagination with (for the sake of demonstration) 900 entries per page (we could have used 1000 as well). Note: Should the pagination abort, such as because you ran out of memory and need to adjust your settings, you can resume from cache!

qef = new QueryExecutionFactoryPaginated(qef, 900);

Create and run a query on this fully buffed QueryExecutionFactory

String queryString = "SELECT ?s { ?s a <http://dbpedia.org/ontology/City> } LIMIT 5000";
QueryExecution qe = qef.createQueryExecution(queryString);
ResultSet rs = qe.execSelect();

Proxy Server Example

This example demonstrates how you can create your own SPARQL web service. You only have to subclass SparqlEndpointBase and override the createQueryExecution method. Look at the Source Code to see how easy it is.

Running the example:

cd jena-sparql-api-example-proxy
mvn jetty:run
# This will now start the proxy on part 5522

In your browser or a terminal visit:

http://localhost:5522/sparql?service-uri=http://dbpedia.org/sparql&query=Select * { ?s ?p ?o } Limit 10


The source code of this repo is published under the Apache License Version 2.0.

This project makes use of several dependencies: When in doubt, please cross-check with the respective projects: