npm.io
1.5.0-alpha.6 • Published 4d ago

@traqula/generator-sparql-1-2

Licence
MIT
Version
1.5.0-alpha.6
Deps
4
Size
36 kB
Vulns
0
Weekly
0
Stars
28

Traqula logo

A query language transpiler framework for JavaScript

Traqula SPARQL 1.2 generator

npm version

Traqula Generator Sparql 1.2 is a SPARQL 1.2 query generator for TypeScript. It can generate SPARQL given the AST created by Traqula parser SPARQL 1-2.

Installation

npm install @traqula/generator-sparql-1-2

or

yarn add @traqula/generator-sparql-1-2

Import

Either through ESM import:

import { Generator } from '@traqula/generator-sparql-1-2';

or CJS require:

const Generator = require('@traqula/generator-sparql-1-2').Generator;

Usage

This package contains a Generator that is able to generate SPARQL 1.2 queries:

import { Parser } from '@traqula/parser-sparql-1-2';
const parser = new Parser();
const ast = parser.parse('SELECT * WHERE { ?s ?p ?o }');

const generator = new Generator();
const queryString = generator.generate(ast);

Note that a single generator cannot generate multiple queries in parallel. The generator is constructed as a simple extension of the existing SPARQL 1.1 generator, the documentation of that generator thus also holds for this one.

Modifying the built Generator

Minor versions keep this engine's API and behavior, and the name, signature and behavior of the rules in its builders, but can add rules or change how existing rules are implemented, such as which rules they call. This only affects projects that patch, delete or individually register rules. See versioning.