{"id":21291535,"url":"https://github.com/Scaseco/jena-sparql-api","last_synced_at":"2025-07-11T16:30:35.969Z","repository":{"id":7754075,"uuid":"9121658","full_name":"SmartDataAnalytics/jena-sparql-api","owner":"SmartDataAnalytics","description":"A collection of Jena-extensions for hiding SPARQL-complexity from the application layer","archived":false,"fork":false,"pushed_at":"2022-12-10T06:14:59.000Z","size":34209,"stargazers_count":56,"open_issues_count":27,"forks_count":14,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-05-15T12:29:57.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SmartDataAnalytics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-30T20:46:44.000Z","updated_at":"2023-05-01T13:35:41.000Z","dependencies_parsed_at":"2023-01-13T15:30:52.893Z","dependency_job_id":null,"html_url":"https://github.com/SmartDataAnalytics/jena-sparql-api","commit_stats":null,"previous_names":["aksw/jena-sparql-api"],"tags_count":100,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartDataAnalytics%2Fjena-sparql-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartDataAnalytics%2Fjena-sparql-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartDataAnalytics%2Fjena-sparql-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartDataAnalytics%2Fjena-sparql-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmartDataAnalytics","download_url":"https://codeload.github.com/SmartDataAnalytics/jena-sparql-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225737974,"owners_count":17516466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T13:35:02.424Z","updated_at":"2025-07-11T16:30:27.415Z","avatar_url":"https://github.com/SmartDataAnalytics.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Welcome to the Jena SPARQL API project\nAn advanced Jena-based SPARQL processing stack for building Semantic Web applications.\n\nHighlights:\n* 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.\n* Transparent basic (normalized) string caching - Just the usual string based caching as it has been implemented over and over again\n* Query Transformations\n* SPARQL sub graph isomorphism checker\n* 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.\n* JPA-based Java\u003c-\u003eRDF mapper: Run JPA criteria queries over Java classes which are actually backed by SPARQL.\n\n\n[![Build Status](http://ci.aksw.org/jenkins/job/jena-sparql-api/badge/icon)](http://ci.aksw.org/jenkins/job/jena-sparql-api/)\n\nThis library offers several [Jena](http://jena.apache.org/)-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](https://github.com/Atmosphere/atmosphere) framework, giving you a kickstart for REST and websocket implementations. \n\n### Maven\nReleases are available on [maven central](http://search.maven.org/#search%7Cga%7C1%7Cjena-sparql-api).\nSnapshots are presently published in our own archiva:\n\n```xml\n\u003crepositories\u003e\n\t\u003crepository\u003e\n\t    \u003cid\u003emaven.aksw.snapshots\u003c/id\u003e\n\t    \u003cname\u003eUniversity Leipzig, AKSW Maven2 Repository\u003c/name\u003e\n\t    \u003curl\u003ehttp://maven.aksw.org/archiva/repository/snapshots\u003c/url\u003e\n\t\u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n        \u003c!-- This is the core artifact; several other ones build on that. --\u003e\n\t\u003cdependency\u003e\n\t\t\u003cgroupId\u003eorg.aksw.jena-sparql-api\u003c/groupId\u003e\n\t\t\u003cartifactId\u003ejena-sparql-api-core\u003c/artifactId\u003e\n\t\t\u003cversion\u003e{check available versions with the link below}\u003c/version\u003e\n\t\u003c/dependency\u003e\t\n\t...\n\u003c/dependencies\u003e\n```\n\nLatest version(s): [jena-sparql-api on maven central](http://search.maven.org/#search%7Cga%7C1%7Cjena-sparql-api)\n\n\n### Project structure\n\nThis library is composed of the following modules:\n* `jena-sparql-api-core`: Contains the core interfaces and basic implementations.\n* `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](http://github.com/AKSW/Sparqlify) is implemented against these interfaces.\n* `jena-sparql-api-utils`: Utilities common to all packages.\n* `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.\n* `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).\n* `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.\n* `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.\n\n\n\n### Usage\n\nHere is a brief summary of what you can do. A complete example is avaible [here](https://github.com/AKSW/jena-sparql-api/blob/master/jena-sparql-api-core/src/main/java/org/aksw/jena_sparql_api/example/Example.java).\n\nHttp Query Execution Factory\n```Java\nQueryExecutionFactory qef = new QueryExecutionFactoryHttp(\"http://dbpedia.org/sparql\", \"http://dbpedia.org\");\n```\nAdding a 2000 millisecond delay in order to be nice to the backend\n```Java\nqef = new QueryExecutionFactoryDelay(qef, 2000);\n```\nSet up a cache\n\n```Java\n// Some boilerplace code which may get simpler soon\nlong timeToLive = 24l * 60l * 60l * 1000l; \nCacheCoreEx cacheBackend = CacheCoreH2.create(\"sparql\", timeToLive, true);\nCacheEx cacheFrontend = new CacheExImpl(cacheBackend);\n\nqef = new QueryExecutionFactoryCacheEx(qef, cacheFrontend);\n```\nAdd pagination with (for the sake of demonstration) 900 entries per page (we could have used 1000 as well).\nNote: Should the pagination abort, such as because you ran out of memory and need to adjust your settings, you can resume from cache!\n```Java\nqef = new QueryExecutionFactoryPaginated(qef, 900);\n```\nCreate and run a query on this fully buffed QueryExecutionFactory\n```Java\nString queryString = \"SELECT ?s { ?s a \u003chttp://dbpedia.org/ontology/City\u003e } LIMIT 5000\";\nQueryExecution qe = qef.createQueryExecution(queryString);\n\t\t\nResultSet rs = qe.execSelect();\nSystem.out.println(ResultSetFormatter.asText(rs));\n```\n\n### Proxy Server Example\nThis example demonstrates how you can create your own SPARQL web service.\nYou only have to subclass `SparqlEndpointBase` and override the `createQueryExecution` method.\nLook at the [Source Code](https://github.com/AKSW/jena-sparql-api/blob/master/jena-sparql-api-example-proxy/src/main/java/org/aksw/jena_sparql_api/example/proxy/SparqlEndpointProxy.java) to see how easy it is.\n\nRunning the example:\n```bash\ncd jena-sparql-api-example-proxy\nmvn jetty:run\n# This will now start the proxy on part 5522\n```\nIn your browser or a terminal visit:\n\n[http://localhost:5522/sparql?service-uri=http://dbpedia.org/sparql\u0026query=Select * { ?s ?p ?o } Limit 10](http://localhost:5522/sparql?service-uri=http%3A%2F%2Fdbpedia.org%2Fsparql\u0026query=Select%20%2A%20%7B%20%3Fs%20%3Fp%20%3Fo%20%7D%20Limit%2010)\n\n\n## License\nThe source code of this repo is published under the [Apache License Version 2.0](https://github.com/AKSW/jena-sparql-api/blob/master/LICENSE).\n\nThis project makes use of several dependencies: When in doubt, please cross-check with the respective projects:\n* [Apache Jena](https://jena.apache.org/) (Apache License 2.0)\n* [Atmosphere](https://github.com/Atmosphere/atmosphere) (Apache License 2.0/Partially CDDL License)\n* [Guava](http://code.google.com/p/guava-libraries/) (Apache License 2.0)\n* [commons-lang](http://commons.apache.org/proper/commons-lang/) (Apache License 2.0)\n* [rdf-json-writer](https://github.com/kasabi/rdf-json-writer) (currently copied but also under Apache 2.0 license, will be changed to maven dep)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FScaseco%2Fjena-sparql-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FScaseco%2Fjena-sparql-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FScaseco%2Fjena-sparql-api/lists"}