Typed SPARQL query modules for TypeScript and JavaScript across Node.js, Vite, and esbuild.
Write SPARQL queries in .rq (query) and .ru (update) files, import them directly as ECMAScript modules, and execute them with strong types against a SPARQL endpoint or RDF/JS dataset.
sparqlc– Core compiler and runtime library (JS API, query analysis, parameter binding).sparqlc-cli– CLI tools:sparqlc-tsc(a drop-in replacement fortscthat type-checks.rq/.ruimports and copies assets) andsparqlc(standalone query compiler).node-loader-sparql– Node.js ESM loader to import.rq/.rufiles directly at runtime.vite-plugin-sparql– Vite plugin for importing and bundling SPARQL queries in web applications.esbuild-plugin-sparql– esbuild plugin to bundle SPARQL queries.ts-plugin-sparqlc– TypeScript language service plugin providing editor type inference and autocomplete for.rq/.ruimports.
Install the integration appropriate for your environment:
# For Node.js runtime imports:
npm i -D node-loader-sparql
# For Vite:
npm i -D vite-plugin-sparql
# For esbuild:
npm i -D esbuild-plugin-sparql
# For TypeScript IDE support:
npm i -D ts-plugin-sparqlc
# For command-line type-checking and builds:
npm i -D sparqlc-cli# queries/find-fruits.rq
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sparqlc: <https://sparqlc.described.at/>
SELECT ?fruit ?label WHERE {
BIND(sparqlc:param("category") AS ?category)
?fruit a ?category ;
rdfs:label ?label .
}import env from '@zazuko/env'
import { ParsingClient } from 'sparql-http-client'
import findFruits from './queries/find-fruits.rq'
const client = new ParsingClient({ endpointUrl: 'https://example.org/sparql' })
const rows = await findFruits(
{ category: env.namedNode('http://example.org/Fruit') },
{ env, client }
)
for (const row of rows) {
console.log(row.fruit.value, row.label.value)
}For detailed guides, configuration options, and API documentation, refer to the individual packages:
- Core compiler and runtime (
sparqlc) - CLI utilities and
sparqlc-tsc(sparqlc-cli) - Node.js ESM loader (
node-loader-sparql) - Vite plugin (
vite-plugin-sparql) - esbuild plugin (
esbuild-plugin-sparql) - TypeScript language service plugin (
ts-plugin-sparqlc)
MIT © Tomasz Pluskiewicz
Each package ships a skill under skills/<package-name>/SKILL.md with guidance for using that integration. Install skills from this repository with:
npx skills add hypermedia-app/sparqlcFor local development, install the workspace skills for Codex and validate their sources:
npm run skills:install
npm run skills:checkThe installer targets project-local Codex skills; use npm exec -- skills add ./packages to choose another agent interactively. Validation also runs in CI with strict checks and no external security scanner.