UNPKG

@tpluscode/sparql-builder

Version:

Simple JS library to build SPARQL queries

368 lines (192 loc) 11.8 kB
# Changelog ## 3.0.1 ### Patch Changes - a4736b6: `UNION` expression typing did not accept a subquery ## 3.0.0 ### Major Changes - ae69cd7: Removed built-in logging. Use an optional parameter to `execute`. Exceptions will be reported as a custom `Error` subclass ## 2.0.4 ### Patch Changes - 463ea01: Update anylogger to 1.1-beta ## 2.0.3 ### Patch Changes - 43e8ce9: Export `WithQuery` to avoid error like "The inferred type of 'X' cannot be named without a reference to '/node_modules/@tpluscode/sparql-builder/lib/WithBuilder.js'. This is likely not portable. A type annotation is necessary." ## 2.0.2 ### Patch Changes - c48bd28: Export the `*Executable` types ## 2.0.1 ### Patch Changes - 5e451cd: Correct imports to work with `moduleResolution = NodeNext` ## 2.0.0 ### Major Changes - b34931c: Updated `sparql-http-client` to v3 The `.execute` method now takes an instance of client and not the `query` object. Also, since the new client does not return a promise from methods which return streams, `await` is no longer necessary ## 1.1.0 ### Minor Changes - 127f72f: No longer depends on `debug`. Use `anylogger-*` adapters to receive logs ### Patch Changes - 5bdc6b0: Relax dependency on `@tpluscode/rdf-ns-builders` ## 1.0.1 ### Patch Changes - 1ad0905: Update `@tpluscode/rdf-string` - improves inference of return types ## 1.0.0 ### Major Changes - 5b1a043: Package is now ESM-only ## 0.4.1 ### Patch Changes - 9812437: ESM exported types which failed in runtime ## 0.4.0 ### Minor Changes - beaf9e1: When interpolating `SELECT` inside another template, it will automatically be wrapped in a graph pattern ## 0.3.31 ### Patch Changes - c7cea63: Main module incorrectly exported types as JS ## 0.3.30 ### Patch Changes - d00f737: Export full builder types of query forms - 0f5f895: Added `DISTINCT` and `AND` which allow modifying the query after it has been initialised ## 0.3.29 ### Patch Changes - 66cb644: Allow `string` as parameter of `UNION` ## 0.3.28 ### Patch Changes - e04f163: SPARQL `UNION` expression builder ## 0.3.27 ### Patch Changes - ec05a22: Added direct dependency on `@types/sparql-http-client` ## 0.3.26 ### Patch Changes - 92e4fcf: Add `prefixes` parameter to `build` so ad-hoc prefixes can be applied to a query Re-export `prefixes` where it's possible to [add prefixes globally](https://github.com/zazuko/rdf-vocabularies#project-specific-prefixes) (re #81) ## 0.3.25 ### Patch Changes - 9f681a2: Type declaration prevented `DELETE.DATA` where the interpolated value was quad array ## 0.3.24 ### Patch Changes - 3f1495e: Adding prologue before the prefixes (closes #75) ## 0.3.23 ### Patch Changes - 329c89e: Shorthand `CONSTRUCT` syntax would interpolate templates incorrectly, producing invalid SPARQL ## 0.3.22 ### Patch Changes - 551f6a1: Updated `@tpluscode/rdf-ns-builders` to v2 ## 0.3.21 ### Patch Changes - 3231508: Correct syntax for `FROM` in shorthand `CONSTRUCT` ## 0.3.20 ### Patch Changes - 6200b56: Add shorthand form `CONSTRUCT WHERE` ## 0.3.19 ### Patch Changes - a4dea43: `DESCRIBE` query function should support `ORDER BY` clause ## 0.3.18 ### Patch Changes - 0e045af: Wrong URLs in package meta ## 0.3.17 ### Patch Changes - ede2fb5: Export types representing queries which can be executed and built - 837447c: Support for `GROUP BY` and `HAVING` clauses in `SELECT` (closes #57) ## 0.3.16 ### Patch Changes - 3e72cd3: Export a function to create `IN` function - 4afbddb: Builder function for `VALUES` (closes #4) ## 0.3.15 ### Patch Changes - 795ff8a: Export SparqlTemplateResult as type ## 0.3.14 ### Patch Changes - d9a173b: Re-export SPARQL template from `@tpluscode/rdf-string` - 51c985a: Update @tpluscode/rdf-ns-builders and rdf-js types ## 0.3.13 ### Patch Changes - fbf2e33: Re-export `sparql` string template tag function from [@tpluscode/rdf-string](https://npm.im/@tpluscode/rdf-string) ## 0.3.12 ### Patch Changes - 928b9d9: Update @tpluscode/rdf-ns-builders All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. ### [0.3.11](https://github.com/tpluscode/ts-template/compare/v0.3.10...v0.3.11) (2021-02-18) ### Features - added WITH clause ([b36a0b2](https://github.com/tpluscode/ts-template/commit/b36a0b22e2de2c59a5fbe4f92a226464118a226d)) ### [0.3.10](https://github.com/tpluscode/ts-template/compare/v0.3.9...v0.3.10) (2020-11-10) ### Features - add FROM to ASK and DESCRIBE builders ([63ccaea](https://github.com/tpluscode/ts-template/commit/63ccaea068243e14b9a2fff9e4ebc8b6eabd07f6)) ### [0.3.9](https://github.com/tpluscode/ts-template/compare/v0.3.8...v0.3.9) (2020-08-08) ### Features - multiple FROM statements ([5fa4f39](https://github.com/tpluscode/ts-template/commit/5fa4f39c1e2e8ff3f986087853b2fa5b73b2f4e0)) ### [0.3.8](https://github.com/tpluscode/ts-template/compare/v0.3.7...v0.3.8) (2020-08-08) ### Features - add FROM (NAMED) to Construct queries ([4a3d662](https://github.com/tpluscode/ts-template/commit/4a3d662974deb3b331160afb013351ddf605a189)) - add FROM NAMED clause builder ([2451561](https://github.com/tpluscode/ts-template/commit/2451561fbb02557dff6219078dd001518abd8186)) ### [0.3.7](https://github.com/tpluscode/ts-template/compare/v0.3.6...v0.3.7) (2020-08-02) ### Features - **select:** added SELECT \* shorthand ([ae9fdf4](https://github.com/tpluscode/ts-template/commit/ae9fdf418e204c9bea5849bf5083710bdc8f2df8)) ### Bug Fixes - **select:** added more intuitive API for multiple ORDER BY ([02a31d1](https://github.com/tpluscode/ts-template/commit/02a31d1ebcf6afd0a930749e3e0231aaa5203032)) - **select:** ordering descending was not implemented ([4537ca8](https://github.com/tpluscode/ts-template/commit/4537ca8242cf9c726f3edd0f6934c62db9b72864)) ### [0.3.6](https://github.com/tpluscode/ts-template/compare/v0.3.5...v0.3.6) (2020-07-01) ### [0.3.5](https://github.com/tpluscode/ts-template/compare/v0.3.4...v0.3.5) (2020-06-08) ### [0.3.4](https://github.com/tpluscode/ts-template/compare/v0.3.3...v0.3.4) (2020-06-07) ### [0.3.3](https://github.com/tpluscode/ts-template/compare/v0.3.2...v0.3.3) (2020-05-21) ### [0.3.2](https://github.com/tpluscode/ts-template/compare/v0.3.1...v0.3.2) (2020-04-08) ### Bug Fixes - skip INSERT in DELETE when empty ([5f0a734](https://github.com/tpluscode/ts-template/commit/5f0a734337480bb618c52b269bca62d64c7c8237)) ### [0.3.1](https://github.com/tpluscode/ts-template/compare/v0.3.0...v0.3.1) (2020-04-01) ### Bug Fixes - parameters of execute were not correctly inferred ([87ed666](https://github.com/tpluscode/ts-template/commit/87ed666a853a46adc08eba33ee8eaf9dddc38080)) ## [0.3.0](https://github.com/tpluscode/ts-template/compare/v0.2.2...v0.3.0) (2020-04-01) ### ⚠ BREAKING CHANGES - changes the signature of execute method ### Features - update to sparql-http-client-2 ([9953317](https://github.com/tpluscode/ts-template/commit/99533173972d87a1ca4b38d98cdf9f6fa9d30dfc)) ### [0.2.2](https://github.com/tpluscode/ts-template/compare/v0.2.1...v0.2.2) (2020-03-02) ### Bug Fixes - **execute:** incomplete export prevented the BASE from being applied ([7f301a5](https://github.com/tpluscode/ts-template/commit/7f301a51fc23999701abd4fa6e136b473f82911c)) - **execute:** the build was not actually called when executing ([437a749](https://github.com/tpluscode/ts-template/commit/437a749580f4154c37768dd203402d9ceadb223b)) ### [0.2.1](https://github.com/tpluscode/ts-template/compare/v0.2.0...v0.2.1) (2020-03-02) ### Bug Fixes - it's impossible to use BASE with execute ([2c43d2b](https://github.com/tpluscode/ts-template/commit/2c43d2bb110fb5c171c2497af11ba1108453559b)) ## [0.2.0](https://github.com/tpluscode/ts-template/compare/v0.1.2...v0.2.0) (2020-03-02) ### ⚠ BREAKING CHANGES - will potentially break if `SparqlQuery<>` was imported and not only inferred ### Bug Fixes - refactor execute to return the correct Response type ([928cdbe](https://github.com/tpluscode/ts-template/commit/928cdbe9c3e841b5546e128706df5f708a3d16e6)) ### [0.1.2](https://github.com/tpluscode/ts-template/compare/v0.1.1...v0.1.2) (2020-02-28) ### Bug Fixes - it was impossible to interpolate another (sub-)query ([a060113](https://github.com/tpluscode/ts-template/commit/a060113c5969c2b63aed716dd4ac0eff4b61af4a)) ### [0.1.1](https://github.com/tpluscode/ts-template/compare/v0.1.0...v0.1.1) (2020-02-25) ### Bug Fixes - the ORDER BY clause must come before LIMIT/OFFSET ([80f77c6](https://github.com/tpluscode/ts-template/commit/80f77c648821876281665cd59aa8fcb18471f3d5)) ## [0.1.0](https://github.com/tpluscode/ts-template/compare/v0.0.10...v0.1.0) (2020-02-24) ### ⚠ BREAKING CHANGES - CONSTRUCT/DESCRIBE now return Response and not a Stream ### Features - **select:** support for ORDER BY ([6841709](https://github.com/tpluscode/ts-template/commit/68417094b7f9d4b9686efb553d6738958bb491cb)) * change the graph query API ([ccfe4d6](https://github.com/tpluscode/ts-template/commit/ccfe4d62e71b2141a4f7432c1e5ebd18fec06bde)) ### [0.0.10](https://github.com/tpluscode/ts-template/compare/v0.0.9...v0.0.10) (2020-02-24) ### Bug Fixes - base was not applied to nested templates ([9ca4bea](https://github.com/tpluscode/ts-template/commit/9ca4bea68b3d93741a3911fa8257497a1925df27)) ### [0.0.9](https://github.com/tpluscode/ts-template/compare/v0.0.8...v0.0.9) (2020-02-24) ### [0.0.8](https://github.com/tpluscode/ts-template/compare/v0.0.7...v0.0.8) (2020-02-24) ### Features - support LIMIT/OFFSET in SPARQL Queries ([a52cc02](https://github.com/tpluscode/ts-template/commit/a52cc0275d8b9ac175e13216926f1a563e69a2fc)) - **select:** support REDUCED and DISTINCT ([e3987e8](https://github.com/tpluscode/ts-template/commit/e3987e82d5e633db919e842149f06e690ebb67bd)) ### [0.0.7](https://github.com/tpluscode/ts-template/compare/v0.0.6...v0.0.7) (2020-02-23) ### Bug Fixes - missing question marks when interpolating variables ([94e590d](https://github.com/tpluscode/ts-template/commit/94e590daf205af3c01aa7a8e8c9ca430758181e2)) ### [0.0.6](https://github.com/tpluscode/ts-template/compare/v0.0.5...v0.0.6) (2020-02-23) ### [0.0.5](https://github.com/tpluscode/ts-template/compare/v0.0.4...v0.0.5) (2020-02-23) ### [0.0.4](https://github.com/tpluscode/ts-template/compare/v0.0.3...v0.0.4) (2020-02-23) ### [0.0.3](https://github.com/tpluscode/ts-template/compare/v0.0.2...v0.0.3) (2020-02-23) ### [0.0.2](https://github.com/tpluscode/ts-template/compare/v0.0.1...v0.0.2) (2020-02-23) ### Features - **delete:** chain multiple INSERT and DELETE calls ([d5659dc](https://github.com/tpluscode/ts-template/commit/d5659dc26829eb03b60928c872ee12b54f593abb)) - **delete:** chaining multiple DATA calls ([c1d3c4c](https://github.com/tpluscode/ts-template/commit/c1d3c4cd9c507d56438f23175a05c2184140886d)) - **delete:** support DELETE..WHERE updates ([6d8dc1f](https://github.com/tpluscode/ts-template/commit/6d8dc1f17a04940ae9a7eca2b5c15c1c53e902d0)) - **insert:** chain multiple INSERT calls ([cc79fed](https://github.com/tpluscode/ts-template/commit/cc79fedf063615dbd0e1da1bd12e7186ac835913)) - **insert:** chaining multiple DATA calls ([60d2b50](https://github.com/tpluscode/ts-template/commit/60d2b50d612a5827bafb0e05bad5c4b3660adc47)) - **insert:** support INSERT..WHERE updates ([e8d254b](https://github.com/tpluscode/ts-template/commit/e8d254b17442aa689dbccd99e3c98adbb44f38de)) - **where:** chaining multiple WHERE calls ([ca88d77](https://github.com/tpluscode/ts-template/commit/ca88d77b2aefcd9fcdc7761a03f29290d19b5678)) ### 0.0.1 (2020-02-22) ### Features - moved all existing code from data-cube-curation ([71c1212](https://github.com/tpluscode/ts-template/commit/71c121246c1a61b7b23ad723da31c920fb5af778))