- Notifications
You must be signed in to change notification settings - Fork0
AtomGraph/sparql-builder
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
SPARQL query builder written in TypeScript. Can be used from both TypeScript and JavaScript, although type-safety is lost in JavaScript.
Itexposes the following classes:
QueryBuilder- builder base classSelectBuilder-SELECTquery builderDescribeBuilder-DESCRIBEquery builder
Thebuild-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 (
windowtarget, output indist/window) - for use with Node.js (
commonjs2target, output indist/node)
- for use in the browser (
The builder is published assparql-builder package on npm. Import it into yourpackage.json:
"dependencies": {"sparql-builder":"^1.0.6" }
Code intest.ts:
import{SelectBuilder}from'sparql-builder';letquery="SELECT ?s { ?s ?p ?o }";letbuilder=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 oftsc && node test.js:
SELECT ?sWHERE { ?s ?p ?o. }ORDERBYDESC (?s) (?p)OFFSET 66LIMIT 42
About
Type-safe SPARQL query builder written in TypeScript
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.