{"id":23626291,"url":"https://github.com/yetanalytics/flint-jena","last_synced_at":"2025-08-30T17:35:56.840Z","repository":{"id":62231020,"uuid":"549788197","full_name":"yetanalytics/flint-jena","owner":"yetanalytics","description":"Library to compile Flint queries and updates into Apache Jena objects","archived":false,"fork":false,"pushed_at":"2024-02-20T21:14:37.000Z","size":232,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-11-28T15:48:55.793Z","etag":null,"topics":["clojure","jena","rdf","sparql"],"latest_commit_sha":null,"homepage":"https://cljdoc.org/d/com.yetanalytics/flint-jena","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yetanalytics.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-10-11T18:32:36.000Z","updated_at":"2024-02-11T18:58:24.000Z","dependencies_parsed_at":"2024-01-08T22:30:15.319Z","dependency_job_id":"d2b1e9bc-eb92-4fa1-bab3-7972987fdc64","html_url":"https://github.com/yetanalytics/flint-jena","commit_stats":{"total_commits":93,"total_committers":2,"mean_commits":46.5,"dds":"0.010752688172043001","last_synced_commit":"3fff0b63238ecff285cb5d6f48928a0c054829ca"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yetanalytics%2Fflint-jena","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yetanalytics%2Fflint-jena/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yetanalytics%2Fflint-jena/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yetanalytics%2Fflint-jena/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yetanalytics","download_url":"https://codeload.github.com/yetanalytics/flint-jena/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231548401,"owners_count":18393559,"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":["clojure","jena","rdf","sparql"],"created_at":"2024-12-27T22:52:48.941Z","updated_at":"2025-08-30T17:35:56.834Z","avatar_url":"https://github.com/yetanalytics.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flint-jena\n\n\u003cimg src=\"logo/logo.svg\" alt=\"Flint Jena Logo\" width=\"250px\" /\u003e\n\n[![CI](https://github.com/yetanalytics/flint-jena/actions/workflows/test.yml/badge.svg)](https://github.com/yetanalytics/flint-jena/actions/workflows/test.yml)\n[![Clojars Project](https://img.shields.io/clojars/v/com.yetanalytics/flint-jena.svg)](https://clojars.org/com.yetanalytics/flint)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-5e0b73.svg)](CODE_OF_CONDUCT.md)\n\nA companion library to [Flint](https://github.com/yetanalytics/flint) for the direct compilation of Flint data into [Apache Jena](https://jena.apache.org/)-based SPARQL queries and updates.\n\nUses Flint version [v0.3.0](https://github.com/yetanalytics/flint/releases/tag/v0.3.0).\n\n## Installation\n\n```clojure\n{com.yetanalytics/flint-jena {:mvn/version \"0.1.3\"\n                              :exclusions [org.clojure/clojure]}}\n```\n\n## Why flint-jena?\n\nVanilla Flint API functions (e.g. `format-query` and `format-updates`) return SPARQL strings, which are useful for many applications; however, within Apache Jena it is more useful to work directly with [`Query`](https://www.javadoc.io/doc/org.apache.jena/jena-arq/latest/org.apache.jena.arq/org/apache/jena/query/Query.html) and [`UpdateRequest`](https://www.javadoc.io/doc/org.apache.jena/jena-arq/latest/org.apache.jena.arq/org/apache/jena/update/UpdateRequest.html) objects. Parsing from Flint to SPARQL strings back to Jena incurs a performance hit compared to directly instantiating the Jena objects, which this library seeks to avoid.\n\n## API Functions\n\nThere are two API functions:\n- `create-query` accepts a single Flint query and returns a `Query` instance.\n- `create-updates` accepts a collection of Flint updates and returns an `UpdateRequest` instance.\n\nBoth API functions have the following keyword arguments:\n- `spec-ed?`: If `true`, then the entire Clojure spec error data is displayed upon a syntax error. Default `false`.\n- `iri-\u003edatatype`: A function from SPARQL literal datatype IRIs to Jena datatype classes, for coercing [typed literals](https://jena.apache.org/documentation/notes/typed-literals.html). The map `axiom/xsd-datatype-map` is the default value.\\*\n- `aggregate-fns`: A set of function IRI strings (_not_ wrapped, so `\\\"http://fn.com\\\"` is a valid entry) to be treated as custom [aggregate expressions](https://jena.apache.org/documentation/query/group-by.html), as opposed to run-of-the-mill non-aggregate expressions.\n\n\\* There is also an `axiom/xsd-datatype-map*` map; the main difference is that there is a more one-to-one mapping of numeric datatype IRIs to classes, whereas `axiom/xsd-datatype-map` coerces them to either `xsd:integer` or `xsd:decimal`.\n\n## Benchmarking (dev only)\n\nThe flint-jena repo comes with benchmarking utilities to bench `create-query` and `create-updates` against the vanilla Flint API functions, specifically the `format-*` functions followed by Jena SPARQL parsing. To bench, clone this repo, then execute the following function:\n```clojure\ncom.yetanalytics.flint-jena-bench/bench\n```\nThe `bench` function accepts the following arguments:\n- `:query-inputs`: A vector of file paths from which to read query EDN. Default: `[\"dev-resources/test-fixtures/query\"]`.\n- `:update-inputs`: A vector of file paths from which to read update EDN. Default: `[\"dev-resources/test-fixtures/query\"]`. \n- `:query-output`: A file path string where to write the query bench output. Default: `\"target/bench/query.txt\"`\n- `:update-output`: A file path string where to write the update bench output. Default: `\"target/bench/update.txt\"`\n\nThe namespace also contains `bench-queries` and `bench-updates` if one only wants to bench `create-query` and `create-updates`, respectively. There are also `bench`, `bench-queries`, and `bench-updates` Makefile targets for benching with default args.\n\nAn example of use:\n```clojure\nclojure -X:bench\n  com.yetanalytics.flint-jena-bench/bench-queries \n  :query-inputs '[\"dev-resources/test-fixtures/query/select/select-1.edn\" \n                  \"dev-resources/test-fixtures/query/select/select-2.edn\"]'\n```\n\nWhich then outputs the following to `target/bench/query.txt`:\n\n```\n************************ Queries creation bench results (in µs) ************************\n\n|        :file | :format-query | :create-query |  :difference | :percent |\n|--------------+---------------+---------------+--------------+----------|\n| select-1.edn |  61.69 ± 0.00 |  25.38 ± 0.00 | 36.30 ± 0.00 |   58.85% |\n| select-2.edn |  91.55 ± 0.00 |  37.61 ± 0.00 | 53.93 ± 0.00 |   58.91% |\n```\n\n## License\n\nCopyright © 2022-2025 Yet Analytics, Inc.\n\nDistributed under the Apache License version 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyetanalytics%2Fflint-jena","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyetanalytics%2Fflint-jena","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyetanalytics%2Fflint-jena/lists"}