New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@atomgraph/sparql-builder

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atomgraph/sparql-builder

SPARQL query builder written in TypeScript. Can be used from both TypeScript and JavaScript, although type-safety is lost in JavaScript.

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

sparql-builder

SPARQL query builder written in TypeScript. Can be used from both TypeScript and JavaScript, although type-safety is lost in JavaScript.

It exposes the following classes:

  • QueryBuilder - builder base class
    • SelectBuilder - SELECT query builder
    • DescribeBuilder - DESCRIBE query builder

Build

The build-dist.sh script does the following:

  • compiles the TypeScript code using tsc
  • runs unit tests using npm test
  • packages the library with webpack
    • for use in the browser (window target, output in dist/window)
    • for use with Node.js (commonjs2 target, output in dist/node)

Usage

The builder is published as sparql-builder package on npm. Import it into your package.json:

    "dependencies": {
        "sparql-builder": "^1.0.6"
    }

Example:

Code in test.ts:

import { SelectBuilder } from 'sparql-builder';

let query = "SELECT ?s { ?s ?p ?o }";

let builder = SelectBuilder.fromString(query).
    limit(42).
    offset(66).
    orderBy(SelectBuilder.ordering(SelectBuilder.var("s"), true)).
    orderBy(SelectBuilder.ordering(SelectBuilder.var("p")));

console.log(builder.toString());

Output of tsc && node test.js:

SELECT ?s WHERE { ?s ?p ?o. }
ORDER BY DESC (?s) (?p)
OFFSET 66
LIMIT 42

Keywords

sparql

FAQs

Package last updated on 07 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts